mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-12-11 20:03:42 +00:00
Merge branch 'master' of gitee.com:openharmony/ability_ability_runtime into 0725
Signed-off-by: XKK <huyingsong@huawei.com>
This commit is contained in:
commit
7589a0038a
3
.gitee/CODEOWNERS
Normal file
3
.gitee/CODEOWNERS
Normal file
@ -0,0 +1,3 @@
|
||||
[Docs Uri Permission]
|
||||
services/uripermmgr/include/file_permission_manager.h @hobbycao
|
||||
services/uripermmgr/src/file_permission_manager.cpp @hobbycao
|
@ -93,7 +93,7 @@ declare_args() {
|
||||
background_task_mgr_continuous_task_enable = true
|
||||
resource_schedule_service_enable = true
|
||||
ability_runtime_power = true
|
||||
ability_runtime_feature_sandboxmanager = true
|
||||
ability_runtime_feature_sandboxmanager = false
|
||||
ability_runtime_relational = true
|
||||
ability_runtime_ces = true
|
||||
ability_runtime_resource = true
|
||||
@ -107,6 +107,7 @@ declare_args() {
|
||||
"com.ohos.textautofill/entry/TextAutoFillAbility"
|
||||
cj_frontend = true
|
||||
ability_runtime_app_no_response_dialog = false
|
||||
ability_runtime_app_no_response_bundlename = "com.ohos.taskmanager"
|
||||
include_app_domain_verify = true
|
||||
|
||||
if (!defined(global_parts_info) ||
|
||||
@ -183,4 +184,9 @@ declare_args() {
|
||||
} else {
|
||||
form_fwk_enable = false
|
||||
}
|
||||
|
||||
if (defined(global_parts_info) &&
|
||||
defined(global_parts_info.accesscontrol_sandbox_manager)) {
|
||||
ability_runtime_feature_sandboxmanager = true
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,8 @@
|
||||
"ability_runtime_auto_fill_ability",
|
||||
"ability_runtime_graphics",
|
||||
"ability_runtime_power",
|
||||
"ability_runtime_app_no_response_dialog"
|
||||
"ability_runtime_app_no_response_dialog",
|
||||
"ability_runtime_app_no_response_bundlename"
|
||||
],
|
||||
"adapted_system_type": [
|
||||
"standard"
|
||||
@ -57,6 +58,7 @@
|
||||
"ets_runtime",
|
||||
"ets_utils",
|
||||
"faultloggerd",
|
||||
"app_file_service",
|
||||
"ffrt",
|
||||
"form_fwk",
|
||||
"graphic_2d",
|
||||
@ -87,8 +89,8 @@
|
||||
"resource_management",
|
||||
"resource_schedule_service",
|
||||
"safwk",
|
||||
"sandbox_manager",
|
||||
"samgr",
|
||||
"sandbox_manager",
|
||||
"screenlock_mgr",
|
||||
"storage_service",
|
||||
"toolchain",
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include <cstdint>
|
||||
|
||||
extern "C" {
|
||||
RetDataI32 FfiOHOSErrorManagerOn(char* onType, CErrorObserver observer);
|
||||
int FfiOHOSErrorManagerOff(char* offType, int observerId);
|
||||
FFI_EXPORT RetDataI32 FfiOHOSErrorManagerOn(char* onType, CErrorObserver observer);
|
||||
FFI_EXPORT int FfiOHOSErrorManagerOff(char* offType, int observerId);
|
||||
}
|
||||
|
||||
#endif
|
@ -63,6 +63,11 @@ std::string CJShellCmdResult::Dump()
|
||||
{
|
||||
return shellCmdResultr_->Dump();
|
||||
}
|
||||
|
||||
void CJAbilityDelegator::FinishTest(const char* msg, int64_t code)
|
||||
{
|
||||
delegator_->FinishUserTest(msg, code);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
int64_t FFIAbilityDelegatorRegistryGetAbilityDelegator()
|
||||
@ -144,6 +149,15 @@ int32_t FFIAbilityDelegatorApplicationContext(int64_t id)
|
||||
}
|
||||
return appContext->GetID();
|
||||
}
|
||||
|
||||
void FFIAbilityDelegatorFinishTest(int64_t id, const char* msg, int64_t code)
|
||||
{
|
||||
auto cjDelegator = FFI::FFIData::GetData<CJAbilityDelegator>(id);
|
||||
if (cjDelegator == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONTEXT, "cj delegator is null.");
|
||||
}
|
||||
cjDelegator->FinishTest(msg, code);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -34,6 +34,7 @@ public:
|
||||
int32_t StartAbility(const AAFwk::Want& want);
|
||||
std::shared_ptr<AppExecFwk::ShellCmdResult> ExecuteShellCommand(const char* cmd, int64_t timeoutSec);
|
||||
std::shared_ptr<AbilityRuntime::ApplicationContext> GetAppContext();
|
||||
void FinishTest(const char* msg, int64_t code);
|
||||
|
||||
private:
|
||||
std::shared_ptr<AppExecFwk::AbilityDelegator> delegator_;
|
||||
@ -58,6 +59,7 @@ CJ_EXPORT int32_t FFIGetExitCode(int64_t id);
|
||||
CJ_EXPORT const char* FFIGetStdResult(int64_t id);
|
||||
CJ_EXPORT const char* FFIDump(int64_t id);
|
||||
CJ_EXPORT int32_t FFIAbilityDelegatorApplicationContext(int64_t id);
|
||||
CJ_EXPORT void FFIAbilityDelegatorFinishTest(int64_t id, const char* msg, int64_t code);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ int FFIGetExitCode();
|
||||
int FFIGetStdResult();
|
||||
int FFIDump();
|
||||
int FFIAbilityDelegatorApplicationContext();
|
||||
int FFIAbilityDelegatorFinishTest();
|
||||
|
||||
struct AbilityContextBroker {
|
||||
int64_t isAbilityContextExisted = 1;
|
||||
|
@ -14,8 +14,9 @@
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#define FFI_EXPORT __attribute__((visibility("default")))
|
||||
|
||||
extern "C" {
|
||||
int FfiOHOSErrorManagerOn();
|
||||
int FfiOHOSErrorManagerOff();
|
||||
FFI_EXPORT int FfiOHOSErrorManagerOn();
|
||||
FFI_EXPORT int FfiOHOSErrorManagerOff();
|
||||
}
|
@ -696,9 +696,9 @@ napi_value JsAbilityManagerInit(napi_env env, napi_value exportObj)
|
||||
env, exportObj, "getForegroundUIAbilities", moduleName, JsAbilityManager::GetForegroundUIAbilities);
|
||||
BindNativeFunction(env, exportObj, "on", moduleName, JsAbilityManager::On);
|
||||
BindNativeFunction(env, exportObj, "off", moduleName, JsAbilityManager::Off);
|
||||
BindNativeFunction(env, exportObj, "isEmbeddedOpenAllowed", moduleName, JsAbilityManager::IsEmbeddedOpenAllowed);
|
||||
BindNativeFunction(
|
||||
env, exportObj, "notifyDebugAssertResult", moduleName, JsAbilityManager::NotifyDebugAssertResult);
|
||||
BindNativeFunction(env, exportObj, "isEmbeddedOpenAllowed", moduleName, JsAbilityManager::IsEmbeddedOpenAllowed);
|
||||
BindNativeFunction(
|
||||
env, exportObj, "setResidentProcessEnabled", moduleName, JsAbilityManager::SetResidentProcessEnabled);
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "end");
|
||||
|
@ -38,8 +38,8 @@ napi_value CreateJSToken(napi_env env, const sptr<IRemoteObject> target)
|
||||
env, "TokenClass", NAPI_AUTO_LENGTH, constructorcb, nullptr, 0, nullptr, &tokenClass);
|
||||
napi_value jsToken = nullptr;
|
||||
napi_new_instance(env, tokenClass, 0, nullptr, &jsToken);
|
||||
auto finalizercb = [](napi_env env, void *data, void *hint) {};
|
||||
napi_wrap(env, jsToken, static_cast<void *>(target.GetRefPtr()), finalizercb, nullptr, nullptr);
|
||||
auto finalizecb = [](napi_env env, void *data, void *hint) {};
|
||||
napi_wrap(env, jsToken, static_cast<void *>(target.GetRefPtr()), finalizecb, nullptr, nullptr);
|
||||
return jsToken;
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,8 @@ private:
|
||||
if (ret == 0) {
|
||||
task.Resolve(env, CreateJsValue(env, ret));
|
||||
} else {
|
||||
task.Reject(env, CreateJsError(env, ret, "clear up application failed."));
|
||||
task.Reject(env, CreateJsError(env, AAFwk::CLEAR_APPLICATION_DATA_FAIL,
|
||||
"clear up application failed."));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -140,6 +140,11 @@ public:
|
||||
GET_CB_INFO_AND_CALL(env, info, JsAppManager, OnClearUpAppData);
|
||||
}
|
||||
|
||||
static napi_value TerminateMission(napi_env env, napi_callback_info info)
|
||||
{
|
||||
GET_CB_INFO_AND_CALL(env, info, JsAppManager, OnTerminateMission);
|
||||
}
|
||||
|
||||
static napi_value IsSharedBundleRunning(napi_env env, napi_callback_info info)
|
||||
{
|
||||
GET_CB_INFO_AND_CALL(env, info, JsAppManager, OnIsSharedBundleRunning);
|
||||
@ -658,7 +663,7 @@ private:
|
||||
std::unique_ptr<NapiAsyncTask> napiAsyncTask = CreateEmptyAsyncTask(env, lastParam, &result);
|
||||
auto asyncTask = [appManager = appManager_, env, task = napiAsyncTask.get()]() {
|
||||
if (appManager == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPMGR, "abilityManager nullptr");
|
||||
TAG_LOGW(AAFwkTag::APPMGR, "appManager nullptr");
|
||||
task->Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INNER));
|
||||
delete task;
|
||||
return;
|
||||
@ -956,6 +961,46 @@ private:
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value OnTerminateMission(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "OnTerminateMission call.");
|
||||
if (argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Params not match");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
int32_t missionId = 0;
|
||||
if (!ConvertFromJsValue(env, argv[INDEX_ZERO], missionId)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "get missionId wrong!");
|
||||
ThrowInvalidParamError(env, "Parse param missionId failed, must be a number.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
napi_value result = nullptr;
|
||||
std::unique_ptr<NapiAsyncTask> napiAsyncTask = CreateEmptyAsyncTask(env, nullptr, &result);
|
||||
auto asyncTask = [missionId, env, task = napiAsyncTask.get()]() {
|
||||
auto amsClient = AAFwk::AbilityManagerClient::GetInstance();
|
||||
if (amsClient == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPMGR, "amsClient nullptr");
|
||||
task->Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INNER));
|
||||
delete task;
|
||||
return;
|
||||
}
|
||||
auto ret = amsClient->TerminateMission(missionId);
|
||||
(ret == ERR_OK) ? task->ResolveWithNoError(env, CreateJsUndefined(env)) :
|
||||
task->Reject(env, CreateJsErrorByNativeErr(env, ret, "Terminate mission failed."));
|
||||
delete task;
|
||||
};
|
||||
if (napi_status::napi_ok != napi_send_event(env, asyncTask, napi_eprio_high)) {
|
||||
napiAsyncTask->Reject(env, CreateJsErrorByNativeErr(env,
|
||||
static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), "Terminate mission failed."));
|
||||
} else {
|
||||
napiAsyncTask.release();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value OnIsSharedBundleRunning(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||
@ -1446,6 +1491,7 @@ napi_value JsAppManagerInit(napi_env env, napi_value exportObj)
|
||||
JsAppManager::KillProcessesByBundleName);
|
||||
BindNativeFunction(env, exportObj, "clearUpApplicationData", moduleName, JsAppManager::ClearUpApplicationData);
|
||||
BindNativeFunction(env, exportObj, "clearUpAppData", moduleName, JsAppManager::ClearUpAppData);
|
||||
BindNativeFunction(env, exportObj, "terminateMission", moduleName, JsAppManager::TerminateMission);
|
||||
BindNativeFunction(env, exportObj, "getAppMemorySize", moduleName, JsAppManager::GetAppMemorySize);
|
||||
BindNativeFunction(env, exportObj, "isRamConstrainedDevice", moduleName, JsAppManager::IsRamConstrainedDevice);
|
||||
BindNativeFunction(env, exportObj, "isSharedBundleRunning", moduleName, JsAppManager::IsSharedBundleRunning);
|
||||
|
@ -20,7 +20,7 @@ class AsyncTaskCallback {
|
||||
this.__impl__ = object;
|
||||
}
|
||||
|
||||
onAsyncTaskCompleted(startupName, startupResult) {
|
||||
onAsyncTaskCompleted(startupName, startupResult): void {
|
||||
console.log('AsyncTaskCallback onAsyncTaskCompleted called, startupName: ' + startupName);
|
||||
this.__impl__.onAsyncTaskCompleted(startupName, startupResult);
|
||||
}
|
||||
|
@ -13,19 +13,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
async function concurrentFunc(startup, asyncCallback, context, startupName) {
|
||||
async function concurrentFunc(startup, asyncCallback, context, startupName): void {
|
||||
'use concurrent';
|
||||
console.log('concurrentFunc start.');
|
||||
let startupResult;
|
||||
await startup.init(context).then((result: Object) => {
|
||||
startupResult = result
|
||||
startupResult = result;
|
||||
let taskPool = requireNapi('taskpool');
|
||||
taskPool.Task.sendData(asyncCallback, startupName, startupResult);
|
||||
});
|
||||
console.log('concurrentFunc end.');
|
||||
}
|
||||
|
||||
function receiveResult(asyncCallback, startupName, startupResult) {
|
||||
function receiveResult(asyncCallback, startupName, startupResult): void {
|
||||
console.log('receiveResult called.');
|
||||
asyncCallback.onAsyncTaskCompleted(startupName, startupResult);
|
||||
console.log('receiveResult end.');
|
||||
|
@ -702,7 +702,6 @@ private:
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
std::vector<int32_t> missionIds;
|
||||
|
||||
if (argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnMoveMissionsToBackground Not enough params");
|
||||
ThrowTooFewParametersError(env);
|
||||
@ -726,7 +725,6 @@ private:
|
||||
}
|
||||
missionIds.push_back(missionId);
|
||||
}
|
||||
|
||||
NapiAsyncTask::CompleteCallback complete =
|
||||
[missionIds](napi_env env, NapiAsyncTask &task, int32_t status) {
|
||||
std::vector<int32_t> resultMissionIds;
|
||||
@ -744,7 +742,6 @@ private:
|
||||
CreateJsErrorByNativeErr(env, ret, PermissionConstants::PERMISSION_MANAGE_MISSION));
|
||||
}
|
||||
};
|
||||
|
||||
napi_value lastParam = (argc <= 1) ? nullptr : argv[1];
|
||||
napi_value result = nullptr;
|
||||
NapiAsyncTask::ScheduleHighQos("MissionManager::OnMoveMissionsToBackground",
|
||||
|
@ -27,6 +27,12 @@ ohos_shared_library("wantconstant") {
|
||||
"napi:ace_napi",
|
||||
]
|
||||
|
||||
cflags_cc = []
|
||||
if (os_dlp_part_enabled) {
|
||||
cflags_cc += [ "-DWITH_DLP" ]
|
||||
external_deps += [ "dlp_permission_service:libdlp_permission_sdk" ]
|
||||
}
|
||||
|
||||
relative_install_dir = "module/ability"
|
||||
|
||||
subsystem_name = "ability"
|
||||
@ -46,6 +52,12 @@ ohos_shared_library("wantconstant_napi") {
|
||||
"napi:ace_napi",
|
||||
]
|
||||
|
||||
cflags_cc = []
|
||||
if (os_dlp_part_enabled) {
|
||||
cflags_cc += [ "-DWITH_DLP" ]
|
||||
external_deps += [ "dlp_permission_service:libdlp_permission_sdk" ]
|
||||
}
|
||||
|
||||
relative_install_dir = "module/app/ability"
|
||||
|
||||
defines = [ "ENABLE_ERRCODE" ]
|
||||
|
@ -341,13 +341,14 @@ ErrCode AbilityContextImpl::TerminateAbilityWithResult(const AAFwk::Want& want,
|
||||
void AbilityContextImpl::SetWeakSessionToken(const wptr<IRemoteObject>& sessionToken)
|
||||
{
|
||||
std::lock_guard lock(sessionTokenMutex_);
|
||||
TAG_LOGD(AAFwkTag::CONTEXT, "Start calling SetWeakSessionToken.");
|
||||
TAG_LOGI(AAFwkTag::CONTEXT, "Start calling SetWeakSessionToken.");
|
||||
sessionToken_ = sessionToken;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> AbilityContextImpl::GetSessionToken()
|
||||
{
|
||||
std::lock_guard lock(sessionTokenMutex_);
|
||||
TAG_LOGI(AAFwkTag::CONTEXT, "calling");
|
||||
return sessionToken_.promote();
|
||||
}
|
||||
|
||||
@ -776,7 +777,7 @@ ErrCode AbilityContextImpl::GetMissionId(int32_t &missionId)
|
||||
|
||||
ErrCode AbilityContextImpl::SetMissionContinueState(const AAFwk::ContinueState &state)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::CONTEXT, "SetMissionContinueState: %{public}d", state);
|
||||
TAG_LOGI(AAFwkTag::CONTEXT, "SetMissionContinueState: %{public}d", state);
|
||||
auto sessionToken = GetSessionToken();
|
||||
if (sessionToken == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONTEXT, "sessionToken is null");
|
||||
|
@ -78,9 +78,9 @@ constexpr const char* ERROR_MSG_TARGET_BUNDLE_NOT_EXIST = "The target bundle doe
|
||||
constexpr const char* ERROR_MSG_NO_RESIDENT_PERMISSION =
|
||||
"The caller application can only set the resident status of the configured process.";
|
||||
constexpr const char* ERROR_MSG_MULTI_APP_NOT_SUPPORTED = "App clone or multi-instance is not supported.";
|
||||
constexpr const char* ERROR_MSG_NOT_APP_CLONE = "The target app is not Clone.";
|
||||
constexpr const char* ERROR_MSG_APP_CLONE_INDEX_INVALID =
|
||||
"The target app clone with the specified index does not exist.";
|
||||
constexpr const char* ERROR_MSG_NOT_APP_CLONE = "The target app is not Clone.";
|
||||
constexpr const char* ERROR_MSG_EXTENSION_START_THIRD_PARTY_APP_CONTROLLED =
|
||||
"The extension can not start the specified third party application.";
|
||||
constexpr const char* ERROR_MSG_EXTENSION_START_SERVICE_CONTROLLED = "The extension can not start the service.";
|
||||
@ -138,8 +138,8 @@ static std::unordered_map<AbilityErrorCode, const char*> ERR_CODE_MAP = {
|
||||
{ AbilityErrorCode::ERROR_CODE_TARGET_BUNDLE_NOT_EXIST, ERROR_MSG_TARGET_BUNDLE_NOT_EXIST },
|
||||
{ AbilityErrorCode::ERROR_CODE_NO_RESIDENT_PERMISSION, ERROR_MSG_NO_RESIDENT_PERMISSION },
|
||||
{ AbilityErrorCode::ERROR_CODE_MULTI_APP_NOT_SUPPORTED, ERROR_MSG_MULTI_APP_NOT_SUPPORTED },
|
||||
{ AbilityErrorCode::ERROR_APP_CLONE_INDEX_INVALID, ERROR_MSG_APP_CLONE_INDEX_INVALID },
|
||||
{ AbilityErrorCode::ERROR_NOT_APP_CLONE, ERROR_MSG_NOT_APP_CLONE },
|
||||
{ AbilityErrorCode::ERROR_APP_CLONE_INDEX_INVALID, ERROR_MSG_APP_CLONE_INDEX_INVALID },
|
||||
{ AbilityErrorCode::ERROR_CODE_EXTENSION_START_THIRD_PARTY_APP_CONTROLLED,
|
||||
ERROR_MSG_EXTENSION_START_THIRD_PARTY_APP_CONTROLLED },
|
||||
{ AbilityErrorCode::ERROR_CODE_EXTENSION_START_SERVICE_CONTROLLED, ERROR_MSG_EXTENSION_START_SERVICE_CONTROLLED},
|
||||
@ -192,11 +192,11 @@ static std::unordered_map<int32_t, AbilityErrorCode> INNER_TO_JS_ERROR_CODE_MAP
|
||||
{ERR_NOT_ALLOW_IMPLICIT_START, AbilityErrorCode::ERROR_CODE_RESOLVE_ABILITY},
|
||||
{ERR_START_OPTIONS_CHECK_FAILED, AbilityErrorCode::ERROR_START_OPTIONS_CHECK_FAILED},
|
||||
{ERR_ABILITY_ALREADY_RUNNING, AbilityErrorCode::ERROR_ABILITY_ALREADY_RUNNING},
|
||||
{ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST, AbilityErrorCode::ERROR_CODE_INVALID_ID},
|
||||
{ERR_ABILITY_NOT_FOREGROUND, AbilityErrorCode::ERROR_CODE_ABILITY_NOT_FOREGROUND},
|
||||
{ERR_WUKONG_MODE_CANT_MOVE_STATE, AbilityErrorCode::ERROR_CODE_WUKONG_MODE_CANT_MOVE_STATE},
|
||||
{ERR_OPERATION_NOT_SUPPORTED_ON_CURRENT_DEVICE, AbilityErrorCode::ERROR_CODE_OPERATION_NOT_SUPPORTED},
|
||||
{ERR_IMPLICIT_START_ABILITY_FAIL, AbilityErrorCode::ERROR_CODE_CANNOT_MATCH_ANY_COMPONENT},
|
||||
{ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST, AbilityErrorCode::ERROR_CODE_INVALID_ID},
|
||||
{ERR_START_OTHER_APP_FAILED, AbilityErrorCode::ERROR_CODE_NOT_SUPPORT_CROSS_APP_START},
|
||||
{ERR_TARGET_BUNDLE_NOT_EXIST, AbilityErrorCode::ERROR_CODE_TARGET_BUNDLE_NOT_EXIST},
|
||||
{ERR_NO_RESIDENT_PERMISSION, AbilityErrorCode::ERROR_CODE_NO_RESIDENT_PERMISSION},
|
||||
|
@ -2151,30 +2151,26 @@ napi_value JsAbilityContext::OnSetMissionContinueState(napi_env env, NapiCallbac
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
auto innerErrorCode = std::make_shared<int32_t>(ERR_OK);
|
||||
NapiAsyncTask::ExecuteCallback execute = [weak = context_, state, innerErrorCode]() {
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::CONTEXT, "context is released");
|
||||
*innerErrorCode = static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT);
|
||||
return;
|
||||
}
|
||||
|
||||
*innerErrorCode = context->SetMissionContinueState(state);
|
||||
};
|
||||
|
||||
NapiAsyncTask::CompleteCallback complete = [innerErrorCode](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
if (*innerErrorCode == ERR_OK) {
|
||||
ErrCode errcode = ERR_OK;
|
||||
auto context = context_.lock();
|
||||
if (context) {
|
||||
errcode = context->SetMissionContinueState(state);
|
||||
} else {
|
||||
TAG_LOGW(AAFwkTag::CONTEXT, "context is released");
|
||||
errcode = static_cast<int>(AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT);
|
||||
}
|
||||
NapiAsyncTask::CompleteCallback complete = [errcode](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
if (errcode == 0) {
|
||||
task.Resolve(env, CreateJsUndefined(env));
|
||||
} else {
|
||||
task.Reject(env, CreateJsErrorByNativeErr(env, *innerErrorCode));
|
||||
task.Reject(env, CreateJsErrorByNativeErr(env, errcode));
|
||||
}
|
||||
};
|
||||
|
||||
napi_value lastParam = (info.argc > ARGC_ONE) ? info.argv[INDEX_ONE] : nullptr;
|
||||
napi_value result = nullptr;
|
||||
NapiAsyncTask::ScheduleHighQos("JsAbilityContext::OnSetMissionContinueState",
|
||||
env, CreateAsyncTaskWithLastParam(env, lastParam, std::move(execute), std::move(complete), &result));
|
||||
env, CreateAsyncTaskWithLastParam(env, lastParam, nullptr, std::move(complete), &result));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -2344,7 +2340,7 @@ napi_value JsAbilityContext::OnRequestModalUIExtension(napi_env env, NapiCallbac
|
||||
if (*innerErrCode == ERR_OK) {
|
||||
task.Resolve(env, CreateJsUndefined(env));
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "OnRequestModalUIExtension is failed %{public}d", *innerErrCode);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "OnRequestModalUIExtension failed %{public}d", *innerErrCode);
|
||||
task.Reject(env, CreateJsErrorByNativeErr(env, *innerErrCode));
|
||||
}
|
||||
};
|
||||
|
@ -25,7 +25,7 @@ void AutoFillExtensionContext::SetAutoFillExtensionCallback(
|
||||
autoFillExtensionCallback_ = autoFillExtensionCallback;
|
||||
}
|
||||
|
||||
void AutoFillExtensionContext::SetSessionInfo(const wptr<AAFwk::SessionInfo> &sessionInfo)
|
||||
void AutoFillExtensionContext::SetSessionInfo(const sptr<AAFwk::SessionInfo> &sessionInfo)
|
||||
{
|
||||
sessionInfo_ = sessionInfo;
|
||||
}
|
||||
@ -33,8 +33,7 @@ void AutoFillExtensionContext::SetSessionInfo(const wptr<AAFwk::SessionInfo> &se
|
||||
int32_t AutoFillExtensionContext::ReloadInModal(const CustomData &customData)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
auto sessionInfo = sessionInfo_.promote();
|
||||
if (sessionInfo == nullptr) {
|
||||
if (sessionInfo_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Session info is nullptr.");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
@ -43,7 +42,7 @@ int32_t AutoFillExtensionContext::ReloadInModal(const CustomData &customData)
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Auto fill extension callback is nullptr.");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
return autoFillExtensionCallback->OnReloadInModal(sessionInfo, customData);
|
||||
return autoFillExtensionCallback->OnReloadInModal(sessionInfo_, customData);
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
@ -508,6 +508,7 @@ bool JsAutoFillExtension::HandleAutoFillCreate(const AAFwk::Want &want, const sp
|
||||
obj, std::shared_ptr<NativeReference>(reinterpret_cast<NativeReference*>(ref)));
|
||||
CallJsOnRequest(want, sessionInfo, uiWindow);
|
||||
uiWindowMap_[obj] = uiWindow;
|
||||
context->SetSessionInfo(sessionInfo);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -525,7 +526,6 @@ void JsAutoFillExtension::ForegroundWindow(const AAFwk::Want &want, const sptr<A
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get context.");
|
||||
return;
|
||||
}
|
||||
context->SetSessionInfo(sessionInfo);
|
||||
|
||||
if (want.HasParameter(WANT_PARAMS_AUTO_FILL_POPUP_WINDOW_KEY)) {
|
||||
isPopup_ = want.GetBoolParam(WANT_PARAMS_AUTO_FILL_POPUP_WINDOW_KEY, false);
|
||||
|
@ -1086,7 +1086,7 @@ private:
|
||||
if (*innerErrCode == ERR_OK) {
|
||||
task.Resolve(env, CreateJsUndefined(env));
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "OnRequestModalUIExtension is failed %{public}d", *innerErrCode);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "OnRequestModalUIExtension failed %{public}d", *innerErrCode);
|
||||
task.Reject(env, CreateJsErrorByNativeErr(env, *innerErrCode));
|
||||
}
|
||||
};
|
||||
|
@ -145,7 +145,7 @@ void JsUIExtensionCallback::CallJsResult(int32_t resultCode, const AAFwk::Want &
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "call");
|
||||
if (env_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "env_ is null, not call js Result.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "env_ is null, not call js Result");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ void JsUIExtensionCallback::CallJsError(int32_t number)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "call");
|
||||
if (env_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "env_ is null, not call js error.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "env_ is null, not call js error");
|
||||
return;
|
||||
}
|
||||
std::string name;
|
||||
|
@ -37,12 +37,12 @@ void JsPhotoEditorExtension::Init(const std::shared_ptr<AppExecFwk::AbilityLocal
|
||||
std::shared_ptr<AppExecFwk::AbilityHandler> &handler,
|
||||
const sptr<IRemoteObject> &token)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Begin init photo editor extension.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Begin init photo editor extension");
|
||||
std::shared_ptr<PhotoEditorExtensionContext> context = std::make_shared<PhotoEditorExtensionContext>();
|
||||
context->SetToken(token);
|
||||
auto appContext = Context::GetApplicationContext();
|
||||
if (appContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "JsPhotoEditorExtension::CreateAndInitContext appContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "JsPhotoEditorExtension::CreateAndInitContext appContext is nullptr");
|
||||
return;
|
||||
}
|
||||
context->SetApplicationInfo(appContext->GetApplicationInfo());
|
||||
@ -50,10 +50,10 @@ void JsPhotoEditorExtension::Init(const std::shared_ptr<AppExecFwk::AbilityLocal
|
||||
context->SetParentContext(appContext);
|
||||
|
||||
if (record == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "JsPhotoEditorExtension::CreateAndInitContext record is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "JsPhotoEditorExtension::CreateAndInitContext record is nullptr");
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Begin init abilityInfo.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Begin init abilityInfo");
|
||||
auto abilityInfo = record->GetAbilityInfo();
|
||||
context->SetAbilityInfo(abilityInfo);
|
||||
context->InitHapModuleInfo(abilityInfo);
|
||||
|
@ -37,14 +37,14 @@ constexpr int32_t INDEX_TWO = 2;
|
||||
|
||||
void JsPhotoEditorExtensionContext::Finalizer(napi_env env, void *data, void *hint)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtensionContext finalizer is called");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
std::unique_ptr<JsPhotoEditorExtensionContext>(static_cast<JsPhotoEditorExtensionContext *>(data));
|
||||
}
|
||||
|
||||
napi_value JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(
|
||||
napi_env env, std::shared_ptr<PhotoEditorExtensionContext> context)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "CreateJsPhotoEditorExtensionContext begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo = nullptr;
|
||||
if (context) {
|
||||
abilityInfo = context->GetAbilityInfo();
|
||||
@ -54,7 +54,7 @@ napi_value JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(
|
||||
std::unique_ptr<JsPhotoEditorExtensionContext> jsContext = std::make_unique<JsPhotoEditorExtensionContext>(context);
|
||||
napi_status status = napi_wrap(env, objValue, jsContext.release(), Finalizer, nullptr, nullptr);
|
||||
if (status != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to do napi wrap.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to do napi wrap");
|
||||
}
|
||||
|
||||
const char *moduleName = "JsPhotoEditorExtensionContext";
|
||||
@ -78,7 +78,7 @@ napi_value JsPhotoEditorExtensionContext::SaveEditedContentWithImage(napi_env en
|
||||
|
||||
napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithUri(napi_env env, NapiCallbackInfo &info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called: param size: %{public}d.",
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called: param size: %{public}d",
|
||||
static_cast<int32_t>(info.argc));
|
||||
|
||||
if (info.argc != ARGC_TWO) {
|
||||
@ -87,21 +87,21 @@ napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithUri(napi_env en
|
||||
}
|
||||
|
||||
std::string uri = AppExecFwk::UnwrapStringFromJS(env, info.argv[INDEX_ZERO]);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Uri: %{public}s.", uri.c_str());
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Uri: %{public}s", uri.c_str());
|
||||
|
||||
auto context = context_.lock();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Context is released.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Context is released");
|
||||
ThrowError(env, static_cast<int32_t>(PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR), ERR_MSG_INTERNAL_ERROR);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
NapiAsyncTask::CompleteCallback complete = [weak = context_, uri](napi_env env, NapiAsyncTask &task,
|
||||
int32_t status) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithUri begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithUri begin");
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Context is released.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Context is released");
|
||||
task.Reject(env, CreateJsError(env, static_cast<int32_t>(PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR)));
|
||||
return;
|
||||
}
|
||||
@ -110,7 +110,7 @@ napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithUri(napi_env en
|
||||
PhotoEditorErrorCode errCode = context->SaveEditedContent(uri, newWant);
|
||||
napi_value abilityResult = AppExecFwk::WrapAbilityResult(env, static_cast<int>(errCode), newWant);
|
||||
if (abilityResult == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Wrap abilityResult failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Wrap abilityResult failed");
|
||||
task.Reject(env, CreateJsError(env, static_cast<int32_t>(PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR)));
|
||||
return;
|
||||
}
|
||||
@ -127,12 +127,12 @@ napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithUri(napi_env en
|
||||
|
||||
napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithImage(napi_env env, NapiCallbackInfo &info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithImage is called: param size: %{public}d.",
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called: param size: %{public}d",
|
||||
static_cast<int32_t>(info.argc));
|
||||
|
||||
auto image = Media::PixelMapNapi::GetPixelMap(env, info.argv[INDEX_ZERO]);
|
||||
if (!image) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Get edited image fail.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Get edited image fail");
|
||||
ThrowError(env, static_cast<int32_t>(PhotoEditorErrorCode::ERROR_CODE_PARAM_ERROR), ERR_MSG_PARAMS_ERROR);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -144,17 +144,17 @@ napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithImage(napi_env
|
||||
|
||||
auto context = context_.lock();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Context is released.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Context is released");
|
||||
ThrowError(env, static_cast<int32_t>(PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR), ERR_MSG_INTERNAL_ERROR);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
NapiAsyncTask::CompleteCallback complete = [weak = context_, image, packOption = std::move(packOption)](
|
||||
napi_env env, NapiAsyncTask &task, int32_t status) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithImage begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithImage begin");
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Context is released.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Context is released");
|
||||
task.Reject(env, CreateJsError(env, static_cast<int32_t>(PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR)));
|
||||
return;
|
||||
}
|
||||
@ -163,7 +163,7 @@ napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithImage(napi_env
|
||||
PhotoEditorErrorCode errCode = context->SaveEditedContent(image, packOption, newWant);
|
||||
napi_value abilityResult = AppExecFwk::WrapAbilityResult(env, static_cast<int>(errCode), newWant);
|
||||
if (abilityResult == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Wrap abilityResult failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Wrap abilityResult failed");
|
||||
task.Reject(env, CreateJsError(env, static_cast<int32_t>(PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR)));
|
||||
return;
|
||||
}
|
||||
@ -197,7 +197,7 @@ bool JsPhotoEditorExtensionContext::UnwrapPackOption(napi_env env, napi_value js
|
||||
}
|
||||
napi_value jsQuality = AppExecFwk::GetPropertyValueByPropertyName(env, jsOption, "quality", napi_number);
|
||||
int quality = AppExecFwk::UnwrapInt32FromJS(env, jsQuality, 100);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Unwrap pack option result, format=%{public}s, quality=%{public}d.", format.c_str(),
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Unwrap pack option result, format=%{public}s, quality=%{public}d", format.c_str(),
|
||||
quality);
|
||||
packOption.format = format;
|
||||
packOption.quality = static_cast<uint8_t>(quality);
|
||||
|
@ -31,27 +31,27 @@ constexpr size_t ARGC_THREE = 3;
|
||||
|
||||
napi_value AttachUIExtensionContext(napi_env env, void *value, void *)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "AttachUIExtensionContext.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
if (value == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid param value.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid param value");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto ptr = reinterpret_cast<std::weak_ptr<PhotoEditorExtensionContext> *>(value)->lock();
|
||||
if (ptr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid context.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid context");
|
||||
return nullptr;
|
||||
}
|
||||
napi_value object = JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(env, ptr);
|
||||
auto contextRef =
|
||||
JsRuntime::LoadSystemModuleByEngine(env, "application.PhotoEditorExtensionContext", &object, ARGC_ONE);
|
||||
if (contextRef == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to load module.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to load module");
|
||||
return nullptr;
|
||||
}
|
||||
auto contextObj = contextRef->GetNapiValue();
|
||||
if (contextObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Load context error.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Load context error");
|
||||
return nullptr;
|
||||
}
|
||||
napi_coerce_to_native_binding_object(env, contextObj, DetachCallbackFunc, AttachUIExtensionContext, value, nullptr);
|
||||
@ -61,7 +61,7 @@ napi_value AttachUIExtensionContext(napi_env env, void *value, void *)
|
||||
[](napi_env, void *data, void *) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Finalizer called");
|
||||
if (data == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Finalizer for weak_ptr is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Finalizer for weak_ptr is nullptr");
|
||||
return;
|
||||
}
|
||||
delete static_cast<std::weak_ptr<PhotoEditorExtensionContext> *>(data);
|
||||
@ -78,36 +78,36 @@ void JsPhotoEditorExtensionImpl::BindContext()
|
||||
{
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
if (jsObj_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "jsobj_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "jsobj_ is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
napi_value obj = jsObj_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "obj is not object.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "obj is not object");
|
||||
return;
|
||||
}
|
||||
if (context_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Context is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Context is nullptr");
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "BindContext CreateJsPhotoEditorExtensionContext.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "BindContext CreateJsPhotoEditorExtensionContext");
|
||||
napi_value contextObj = JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(env, context_);
|
||||
if (contextObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Create js ui extension context error.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Create js ui extension context error");
|
||||
return;
|
||||
}
|
||||
|
||||
shellContextRef_ =
|
||||
JsRuntime::LoadSystemModuleByEngine(env, "application.PhotoEditorExtensionContext", &contextObj, ARGC_ONE);
|
||||
if (shellContextRef_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get loadSystemModuleByEngine.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get loadSystemModuleByEngine");
|
||||
return;
|
||||
}
|
||||
contextObj = shellContextRef_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, contextObj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get context native object.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get context native object");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -120,13 +120,13 @@ void JsPhotoEditorExtensionImpl::BindContext()
|
||||
[](napi_env, void *data, void *) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Finalizer called");
|
||||
if (data == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Finalizer for weak_ptr is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Finalizer for weak_ptr is nullptr");
|
||||
return;
|
||||
}
|
||||
delete static_cast<std::weak_ptr<PhotoEditorExtensionContext> *>(data);
|
||||
},
|
||||
nullptr, nullptr);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Bind context end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Bind context end");
|
||||
}
|
||||
|
||||
void JsPhotoEditorExtensionImpl::OnForeground(const Want &want, sptr<AAFwk::SessionInfo> sessionInfo)
|
||||
@ -142,17 +142,17 @@ void JsPhotoEditorExtensionImpl::OnForeground(const Want &want, sptr<AAFwk::Sess
|
||||
void JsPhotoEditorExtensionImpl::OnStartContentEditing(const AAFwk::Want &want,
|
||||
const sptr<AAFwk::SessionInfo> &sessionInfo)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsPhotoEditorExtension want: (%{public}s), begin.", want.ToUri().c_str());
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsPhotoEditorExtension want: (%{public}s), begin", want.ToUri().c_str());
|
||||
|
||||
std::string imageUri = want.GetStringParam("ability.params.stream");
|
||||
if (imageUri.empty()) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnStartContentEditing failed, imageUri is empty.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnStartContentEditing failed, imageUri is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsPhotoEditorExtension imageUri: (%{public}s), begin.", imageUri.c_str());
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsPhotoEditorExtension imageUri: (%{public}s), begin", imageUri.c_str());
|
||||
if (context_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "PhotoEditorExtension context is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "PhotoEditorExtension context is nullptr");
|
||||
return;
|
||||
}
|
||||
context_->SetWant(std::make_shared<AAFwk::Want>(want));
|
||||
@ -160,12 +160,12 @@ void JsPhotoEditorExtensionImpl::OnStartContentEditing(const AAFwk::Want &want,
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
if (env == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Env is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Env is nullptr");
|
||||
return;
|
||||
}
|
||||
napi_value jsWant = AppExecFwk::WrapWant(env, want);
|
||||
if (jsWant == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get want.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get want");
|
||||
return;
|
||||
}
|
||||
napi_value jsImageUri;
|
||||
|
@ -30,14 +30,14 @@ const std::string MODE_RW = "/rw/";
|
||||
|
||||
PhotoEditorErrorCode PhotoEditorExtensionContext::SaveEditedContent(const std::string &uri, AAFwk::Want &newWant)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Save content editing with uri begin, uri: %{public}s.", uri.c_str());
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Save content editing with uri begin, uri: %{public}s", uri.c_str());
|
||||
|
||||
const std::string panelUri = want_->GetStringParam(PANEL_TRANSFER_FILE_PATH);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "PanelUri: %{public}s.", panelUri.c_str());
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "PanelUri: %{public}s", panelUri.c_str());
|
||||
|
||||
PhotoEditorErrorCode errCode = CopyImageToPanel(uri, panelUri);
|
||||
if (errCode == PhotoEditorErrorCode::ERROR_OK) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Save content succeed.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Save content succeed");
|
||||
auto pos = uri.find_last_of(".");
|
||||
newWant.SetUri(panelUri);
|
||||
newWant.SetType("image/" + uri.substr(pos + 1));
|
||||
@ -50,7 +50,7 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::SaveEditedContent(const std::s
|
||||
AAFwk::Want &newWant)
|
||||
{
|
||||
const std::string panelUri = want_->GetStringParam(PANEL_TRANSFER_FILE_PATH);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "PanelUri: %{public}s.", panelUri.c_str());
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "PanelUri: %{public}s", panelUri.c_str());
|
||||
|
||||
std::string panelPhysicalPath = panelUri;
|
||||
std::string bundleName = GetRealPath(panelPhysicalPath);
|
||||
@ -59,7 +59,7 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::SaveEditedContent(const std::s
|
||||
std::ofstream panelFile;
|
||||
panelFile.open(panelPhysicalPath, std::ios::binary);
|
||||
if (!panelFile.is_open()) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Can not open panel file.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Can not open panel file");
|
||||
panelFile.close();
|
||||
return PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
@ -67,27 +67,27 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::SaveEditedContent(const std::s
|
||||
Media::ImagePacker imagePacker;
|
||||
uint32_t err = imagePacker.StartPacking(panelFile, packOption);
|
||||
if (err != Media::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to StartPacking %{public}d.", err);
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to StartPacking %{public}d", err);
|
||||
panelFile.close();
|
||||
return PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
err = imagePacker.AddImage(*image);
|
||||
if (err != Media::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to AddImage %{public}d.", err);
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to AddImage %{public}d", err);
|
||||
panelFile.close();
|
||||
return PhotoEditorErrorCode::ERROR_CODE_IMAGE_INPUT_ERROR;
|
||||
}
|
||||
|
||||
int64_t packedSize = 0;
|
||||
if (imagePacker.FinalizePacking(packedSize) != Media::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "FinalizePacking failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "FinalizePacking failed");
|
||||
panelFile.close();
|
||||
return PhotoEditorErrorCode::ERROR_CODE_IMAGE_INPUT_ERROR;
|
||||
}
|
||||
|
||||
if (packedSize > static_cast<int64_t>(MAX_IMAGE_SIZE)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Image is too big, bigger than 50M.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Image is too big, bigger than 50M");
|
||||
panelFile.close();
|
||||
return PhotoEditorErrorCode::ERROR_CODE_IMAGE_TOO_BIG_ERROR;
|
||||
}
|
||||
@ -95,14 +95,14 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::SaveEditedContent(const std::s
|
||||
panelFile.close();
|
||||
newWant.SetUri(panelUri);
|
||||
newWant.SetType(packOption.format);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Save content succeed.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Save content succeed");
|
||||
return PhotoEditorErrorCode::ERROR_OK;
|
||||
}
|
||||
|
||||
void PhotoEditorExtensionContext::SetWant(const std::shared_ptr<AAFwk::Want> &want)
|
||||
{
|
||||
want_ = want;
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Set want done.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Set want done");
|
||||
}
|
||||
|
||||
PhotoEditorErrorCode PhotoEditorExtensionContext::CopyImageToPanel(const std::string &imageUri,
|
||||
@ -112,7 +112,7 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::CopyImageToPanel(const std::st
|
||||
std::string bundleName = GetRealPath(panelPhysicalPath);
|
||||
panelPhysicalPath = PATH_SHARE + MODE_RW + bundleName + panelPhysicalPath;
|
||||
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "ImageUri: %{public}s, panelPhysicalPath: %{public}s.", imageUri.c_str(),
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "ImageUri: %{public}s, panelPhysicalPath: %{public}s", imageUri.c_str(),
|
||||
panelPhysicalPath.c_str());
|
||||
|
||||
char imagePath[PATH_MAX] = {0};
|
||||
@ -124,7 +124,7 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::CopyImageToPanel(const std::st
|
||||
std::ifstream sourceFile;
|
||||
sourceFile.open(imagePath, std::ios::binary);
|
||||
if (!sourceFile.is_open()) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Can not open source file.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Can not open source file");
|
||||
sourceFile.close();
|
||||
return PhotoEditorErrorCode::ERROR_CODE_IMAGE_INPUT_ERROR;
|
||||
}
|
||||
@ -132,7 +132,7 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::CopyImageToPanel(const std::st
|
||||
sourceFile.seekg(0, sourceFile.end);
|
||||
std::streampos imageSize = sourceFile.tellg();
|
||||
if (static_cast<uint64_t>(imageSize) > MAX_IMAGE_SIZE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Image is too big, bigger than 50M.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Image is too big, bigger than 50M");
|
||||
sourceFile.close();
|
||||
return PhotoEditorErrorCode::ERROR_CODE_IMAGE_TOO_BIG_ERROR;
|
||||
}
|
||||
@ -141,7 +141,7 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::CopyImageToPanel(const std::st
|
||||
std::ofstream panelFile;
|
||||
panelFile.open(panelPhysicalPath, std::ios::binary);
|
||||
if (!panelFile.is_open()) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Can not open panel file.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Can not open panel file");
|
||||
sourceFile.close();
|
||||
return PhotoEditorErrorCode::ERROR_CODE_IMAGE_INPUT_ERROR;
|
||||
}
|
||||
@ -154,7 +154,7 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::CopyImageToPanel(const std::st
|
||||
sourceFile.close();
|
||||
panelFile.close();
|
||||
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Copy succeed.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Copy succeed");
|
||||
return PhotoEditorErrorCode::ERROR_OK;
|
||||
}
|
||||
|
||||
|
@ -36,4 +36,4 @@ ShareExtension *ShareExtension::Create(const std::unique_ptr<Runtime> &runtime)
|
||||
}
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
@ -183,7 +183,7 @@ napi_value JsEmbeddableUIAbilityContext::MoveAbilityToBackground(napi_env env, n
|
||||
napi_value JsEmbeddableUIAbilityContext::OnStartAbility(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Start ability in embedded screen mode.");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Start ability in embedded screen mode");
|
||||
CHECK_POINTER_RETURN(env, jsUIExtensionContext_);
|
||||
return jsUIExtensionContext_->OnStartAbility(env, info);
|
||||
}
|
||||
@ -205,7 +205,7 @@ napi_value JsEmbeddableUIAbilityContext::OnOpenLink(napi_env env, NapiCallbackIn
|
||||
napi_value JsEmbeddableUIAbilityContext::OnStartAbilityForResult(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Start ability for result in embedded screen mode.");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Start ability for result in embedded screen mode");
|
||||
CHECK_POINTER_RETURN(env, jsUIExtensionContext_);
|
||||
return jsUIExtensionContext_->OnStartAbilityForResult(env, info);
|
||||
}
|
||||
@ -216,7 +216,7 @@ napi_value JsEmbeddableUIAbilityContext::OnStartAbilityForResult(napi_env env, N
|
||||
napi_value JsEmbeddableUIAbilityContext::OnConnectAbility(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Connect ability in embedded screen mode.");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Connect ability in embedded screen mode");
|
||||
CHECK_POINTER_RETURN(env, jsUIExtensionContext_);
|
||||
return jsUIExtensionContext_->OnConnectAbility(env, info);
|
||||
}
|
||||
@ -227,7 +227,7 @@ napi_value JsEmbeddableUIAbilityContext::OnConnectAbility(napi_env env, NapiCall
|
||||
napi_value JsEmbeddableUIAbilityContext::OnDisconnectAbility(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Disconnect ability in embedded screen mode.");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Disconnect ability in embedded screen mode");
|
||||
CHECK_POINTER_RETURN(env, jsUIExtensionContext_);
|
||||
return jsUIExtensionContext_->OnDisconnectAbility(env, info);
|
||||
}
|
||||
@ -238,7 +238,7 @@ napi_value JsEmbeddableUIAbilityContext::OnDisconnectAbility(napi_env env, NapiC
|
||||
napi_value JsEmbeddableUIAbilityContext::OnTerminateSelf(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "TerminateSelf in embedded screen mode.");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "TerminateSelf in embedded screen mode");
|
||||
CHECK_POINTER_RETURN(env, jsUIExtensionContext_);
|
||||
return jsUIExtensionContext_->OnTerminateSelf(env, info);
|
||||
}
|
||||
@ -249,7 +249,7 @@ napi_value JsEmbeddableUIAbilityContext::OnTerminateSelf(napi_env env, NapiCallb
|
||||
napi_value JsEmbeddableUIAbilityContext::OnTerminateSelfWithResult(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "TerminateSelfWithResult ability in embedded screen mode.");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "TerminateSelfWithResult ability in embedded screen mode");
|
||||
CHECK_POINTER_RETURN(env, jsUIExtensionContext_);
|
||||
return jsUIExtensionContext_->OnTerminateSelfWithResult(env, info);
|
||||
}
|
||||
@ -260,7 +260,7 @@ napi_value JsEmbeddableUIAbilityContext::OnTerminateSelfWithResult(napi_env env,
|
||||
napi_value JsEmbeddableUIAbilityContext::OnStartAbilityAsCaller(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start ability as caller in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start ability as caller in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -271,7 +271,7 @@ napi_value JsEmbeddableUIAbilityContext::OnStartAbilityAsCaller(napi_env env, Na
|
||||
napi_value JsEmbeddableUIAbilityContext::OnStartAbilityWithAccount(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start ability with account in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start ability with account in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -282,7 +282,7 @@ napi_value JsEmbeddableUIAbilityContext::OnStartAbilityWithAccount(napi_env env,
|
||||
napi_value JsEmbeddableUIAbilityContext::OnStartAbilityByCall(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start ability by caller in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start ability by caller in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -293,7 +293,7 @@ napi_value JsEmbeddableUIAbilityContext::OnStartAbilityByCall(napi_env env, Napi
|
||||
napi_value JsEmbeddableUIAbilityContext::OnStartAbilityForResultWithAccount(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start ability for result in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start ability for result in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -304,7 +304,7 @@ napi_value JsEmbeddableUIAbilityContext::OnStartAbilityForResultWithAccount(napi
|
||||
napi_value JsEmbeddableUIAbilityContext::OnStartExtensionAbility(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start extension in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start extension in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -315,7 +315,7 @@ napi_value JsEmbeddableUIAbilityContext::OnStartExtensionAbility(napi_env env, N
|
||||
napi_value JsEmbeddableUIAbilityContext::OnStartExtensionAbilityWithAccount(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start extensionin with account in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start extensionin with account in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -326,7 +326,7 @@ napi_value JsEmbeddableUIAbilityContext::OnStartExtensionAbilityWithAccount(napi
|
||||
napi_value JsEmbeddableUIAbilityContext::OnStopExtensionAbility(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Stop extensionin in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Stop extensionin in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -337,7 +337,7 @@ napi_value JsEmbeddableUIAbilityContext::OnStopExtensionAbility(napi_env env, Na
|
||||
napi_value JsEmbeddableUIAbilityContext::OnStopExtensionAbilityWithAccount(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Stop extensionin with account in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Stop extensionin with account in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -348,7 +348,7 @@ napi_value JsEmbeddableUIAbilityContext::OnStopExtensionAbilityWithAccount(napi_
|
||||
napi_value JsEmbeddableUIAbilityContext::OnConnectAbilityWithAccount(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Connect ability with account in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Connect ability with account in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -359,7 +359,7 @@ napi_value JsEmbeddableUIAbilityContext::OnConnectAbilityWithAccount(napi_env en
|
||||
napi_value JsEmbeddableUIAbilityContext::OnRestoreWindowStage(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Restore window stage with account in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Restore window stage with account in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -370,7 +370,7 @@ napi_value JsEmbeddableUIAbilityContext::OnRestoreWindowStage(napi_env env, Napi
|
||||
napi_value JsEmbeddableUIAbilityContext::OnIsTerminating(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Get terminating state in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Get terminating state in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -381,7 +381,7 @@ napi_value JsEmbeddableUIAbilityContext::OnIsTerminating(napi_env env, NapiCallb
|
||||
napi_value JsEmbeddableUIAbilityContext::OnStartRecentAbility(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start recent ability in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start recent ability in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -392,7 +392,7 @@ napi_value JsEmbeddableUIAbilityContext::OnStartRecentAbility(napi_env env, Napi
|
||||
napi_value JsEmbeddableUIAbilityContext::OnRequestDialogService(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Request dialog service in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Request dialog service in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -403,7 +403,7 @@ napi_value JsEmbeddableUIAbilityContext::OnRequestDialogService(napi_env env, Na
|
||||
napi_value JsEmbeddableUIAbilityContext::OnReportDrawnCompleted(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Report Drawn Completed in half screen mode.");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Report Drawn Completed in half screen mode");
|
||||
CHECK_POINTER_RETURN(env, jsUIExtensionContext_);
|
||||
return jsUIExtensionContext_->OnReportDrawnCompleted(env, info);
|
||||
}
|
||||
@ -414,7 +414,7 @@ napi_value JsEmbeddableUIAbilityContext::OnReportDrawnCompleted(napi_env env, Na
|
||||
napi_value JsEmbeddableUIAbilityContext::OnSetMissionContinueState(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Set mission continue state in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Set mission continue state in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -425,7 +425,7 @@ napi_value JsEmbeddableUIAbilityContext::OnSetMissionContinueState(napi_env env,
|
||||
napi_value JsEmbeddableUIAbilityContext::OnStartAbilityByType(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start ability by type in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Start ability by type in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -436,7 +436,7 @@ napi_value JsEmbeddableUIAbilityContext::OnStartAbilityByType(napi_env env, Napi
|
||||
napi_value JsEmbeddableUIAbilityContext::OnMoveAbilityToBackground(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnMoveAbilityToBackground in half screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnMoveAbilityToBackground in half screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -460,7 +460,7 @@ napi_value JsEmbeddableUIAbilityContext::SetMissionIcon(napi_env env, napi_callb
|
||||
napi_value JsEmbeddableUIAbilityContext::OnSetMissionLabel(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Set mission label in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Set mission label in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -471,7 +471,7 @@ napi_value JsEmbeddableUIAbilityContext::OnSetMissionLabel(napi_env env, NapiCal
|
||||
napi_value JsEmbeddableUIAbilityContext::OnSetMissionIcon(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Set mission icon in embedded screen mode.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Set mission icon in embedded screen mode");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -529,7 +529,7 @@ void JsEmbeddableUIAbilityContext::WrapJsUIExtensionContext(napi_env env,
|
||||
napi_value JsEmbeddableUIAbilityContext::CreateJsEmbeddableUIAbilityContext(napi_env env,
|
||||
std::shared_ptr<AbilityContext> uiAbiContext, std::shared_ptr<UIExtensionContext> uiExtContext, int32_t screenMode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Create JS embeddable UIAbility context begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Create JS embeddable UIAbility context begin");
|
||||
napi_value objValue = nullptr;
|
||||
if (screenMode == AAFwk::JUMP_SCREEN_MODE) {
|
||||
WrapJsUIAbilityContext(env, uiAbiContext, objValue, screenMode);
|
||||
|
@ -55,20 +55,20 @@ constexpr size_t ARGC_TWO = 2;
|
||||
|
||||
napi_value AttachUIExtensionContext(napi_env env, void *value, void *extValue)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "AttachUIExtensionContext");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
if (value == nullptr || extValue == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "invalid parameter.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "invalid parameter");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto ptr = reinterpret_cast<std::weak_ptr<UIExtensionContext> *>(value)->lock();
|
||||
if (ptr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "invalid context.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "invalid context");
|
||||
return nullptr;
|
||||
}
|
||||
auto screenModePtr = reinterpret_cast<std::weak_ptr<int32_t> *>(extValue)->lock();
|
||||
if (screenModePtr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid screenModePtr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid screenModePtr");
|
||||
return nullptr;
|
||||
}
|
||||
napi_value contextObj = nullptr;
|
||||
@ -89,7 +89,7 @@ napi_value AttachUIExtensionContext(napi_env env, void *value, void *extValue)
|
||||
contextObj = contextRef->GetNapiValue();
|
||||
}
|
||||
if (contextObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "load context error.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "load context error");
|
||||
return nullptr;
|
||||
}
|
||||
napi_coerce_to_native_binding_object(env, contextObj, DetachCallbackFunc,
|
||||
@ -116,7 +116,7 @@ JsUIExtension::JsUIExtension(JsRuntime& jsRuntime) : jsRuntime_(jsRuntime)
|
||||
|
||||
JsUIExtension::~JsUIExtension()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Js ui extension destructor.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Js ui extension destructor");
|
||||
auto context = GetContext();
|
||||
if (context) {
|
||||
context->Unbind();
|
||||
@ -135,7 +135,7 @@ void JsUIExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
const sptr<IRemoteObject> &token)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension begin init");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "init");
|
||||
CHECK_POINTER(record);
|
||||
UIExtension::Init(record, application, handler, token);
|
||||
if (Extension::abilityInfo_ == nullptr || Extension::abilityInfo_->srcEntrance.empty()) {
|
||||
@ -199,7 +199,7 @@ void JsUIExtension::BindContext(napi_env env, napi_value obj, std::shared_ptr<AA
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get context");
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "BindContext CreateJsUIExtensionContext.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "BindContext CreateJsUIExtensionContext");
|
||||
if (want == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Want info is null.");
|
||||
return;
|
||||
@ -208,7 +208,7 @@ void JsUIExtension::BindContext(napi_env env, napi_value obj, std::shared_ptr<AA
|
||||
napi_value contextObj = nullptr;
|
||||
CreateJSContext(env, contextObj, context, screenMode);
|
||||
if (shellContextRef_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get LoadSystemModuleByEngine.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get LoadSystemModuleByEngine");
|
||||
return;
|
||||
}
|
||||
contextObj = shellContextRef_->GetNapiValue();
|
||||
@ -231,13 +231,13 @@ void JsUIExtension::BindContext(napi_env env, napi_value obj, std::shared_ptr<AA
|
||||
delete static_cast<std::weak_ptr<UIExtensionContext>*>(data);
|
||||
},
|
||||
nullptr, nullptr);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Init end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtension::OnStart(const AAFwk::Want &want)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnStart begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
Extension::OnStart(want);
|
||||
auto context = GetContext();
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
@ -269,18 +269,18 @@ void JsUIExtension::OnStart(const AAFwk::Want &want)
|
||||
napi_value argv[] = {CreateJsLaunchParam(env, launchParam) };
|
||||
CallObjectMethod("onCreate", argv, ARGC_ONE);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnStart end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtension::OnStop()
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
UIExtension::OnStop();
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnStop begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
CallObjectMethod("onDestroy");
|
||||
OnStopCallBack();
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnStop end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
void JsUIExtension::OnStop(AppExecFwk::AbilityTransactionCallbackInfo<> *callbackInfo, bool &isAsyncCallback)
|
||||
{
|
||||
@ -290,7 +290,7 @@ void JsUIExtension::OnStop(AppExecFwk::AbilityTransactionCallbackInfo<> *callbac
|
||||
return;
|
||||
}
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStop begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
UIExtension::OnStop();
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_value result = CallObjectMethod("onDestroy", nullptr, 0, true);
|
||||
@ -304,7 +304,7 @@ void JsUIExtension::OnStop(AppExecFwk::AbilityTransactionCallbackInfo<> *callbac
|
||||
auto asyncCallback = [extensionWeakPtr = weakPtr]() {
|
||||
auto jsUIExtension = extensionWeakPtr.lock();
|
||||
if (jsUIExtension == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "extension is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "extension is nullptr");
|
||||
return;
|
||||
}
|
||||
jsUIExtension->OnStopCallBack();
|
||||
@ -312,10 +312,10 @@ void JsUIExtension::OnStop(AppExecFwk::AbilityTransactionCallbackInfo<> *callbac
|
||||
callbackInfo->Push(asyncCallback);
|
||||
isAsyncCallback = CallPromise(result, callbackInfo);
|
||||
if (!isAsyncCallback) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to call promise.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to call promise");
|
||||
OnStopCallBack();
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStop end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtension::OnStopCallBack()
|
||||
@ -328,7 +328,7 @@ void JsUIExtension::OnStopCallBack()
|
||||
bool ret = ConnectionManager::GetInstance().DisconnectCaller(context->GetToken());
|
||||
if (ret) {
|
||||
ConnectionManager::GetInstance().ReportConnectionLeakEvent(getpid(), gettid());
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "The service connection is not disconnected.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "The service connection is not disconnected");
|
||||
}
|
||||
|
||||
auto applicationContext = Context::GetApplicationContext();
|
||||
@ -340,14 +340,14 @@ void JsUIExtension::OnStopCallBack()
|
||||
bool JsUIExtension::CheckPromise(napi_value result)
|
||||
{
|
||||
if (result == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "result is null, no need to call promise.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "result is null, no need to call promise");
|
||||
return false;
|
||||
}
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
bool isPromise = false;
|
||||
napi_is_promise(env, result, &isPromise);
|
||||
if (!isPromise) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "result is not promise, no need to call promise.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "result is not promise, no need to call promise");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -359,7 +359,7 @@ napi_value PromiseCallback(napi_env env, napi_callback_info info)
|
||||
NAPI_CALL_NO_THROW(napi_get_cb_info(env, info, nullptr, nullptr, nullptr, &data), nullptr);
|
||||
auto *callbackInfo = static_cast<AppExecFwk::AbilityTransactionCallbackInfo<> *>(data);
|
||||
if (callbackInfo == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Invalid input info.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Invalid input info");
|
||||
return nullptr;
|
||||
}
|
||||
callbackInfo->Call();
|
||||
@ -372,19 +372,19 @@ bool JsUIExtension::CallPromise(napi_value result, AppExecFwk::AbilityTransactio
|
||||
{
|
||||
auto env = jsRuntime_.GetNapiEnv();
|
||||
if (!CheckTypeForNapiValue(env, result, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to convert native value to NativeObject.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to convert native value to NativeObject");
|
||||
return false;
|
||||
}
|
||||
napi_value then = nullptr;
|
||||
napi_get_named_property(env, result, "then", &then);
|
||||
if (then == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get property: then.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get property: then");
|
||||
return false;
|
||||
}
|
||||
bool isCallable = false;
|
||||
napi_is_callable(env, then, &isCallable);
|
||||
if (!isCallable) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "property then is not callable.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "property then is not callable");
|
||||
return false;
|
||||
}
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
@ -404,7 +404,7 @@ sptr<IRemoteObject> JsUIExtension::OnConnect(const AAFwk::Want &want)
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
auto remoteObj = NAPI_ohos_rpc_getNativeRemoteObject(env, result);
|
||||
if (remoteObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "remoteObj is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "remoteObj is nullptr");
|
||||
}
|
||||
return remoteObj;
|
||||
}
|
||||
@ -413,10 +413,10 @@ void JsUIExtension::OnDisconnect(const AAFwk::Want &want)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
Extension::OnDisconnect(want);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnDisconnect begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnDisconnect begin");
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
CallOnDisconnect(want, false);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnDisconnect end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnDisconnect end");
|
||||
}
|
||||
|
||||
void JsUIExtension::OnCommandWindow(const AAFwk::Want &want, const sptr<AAFwk::SessionInfo> &sessionInfo,
|
||||
@ -424,7 +424,7 @@ void JsUIExtension::OnCommandWindow(const AAFwk::Want &want, const sptr<AAFwk::S
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "sessionInfo is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "sessionInfo is nullptr");
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin. persistentId: %{private}d, winCmd: %{public}d",
|
||||
@ -447,7 +447,7 @@ void JsUIExtension::OnCommandWindow(const AAFwk::Want &want, const sptr<AAFwk::S
|
||||
DestroyWindow(sessionInfo);
|
||||
break;
|
||||
default:
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "unsupported cmd.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "unsupported cmd");
|
||||
break;
|
||||
}
|
||||
OnCommandWindowDone(sessionInfo, winCmd);
|
||||
@ -459,22 +459,22 @@ bool JsUIExtension::ForegroundWindowWithInsightIntent(const AAFwk::Want &want,
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
if (!HandleSessionCreate(want, sessionInfo)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "HandleSessionCreate failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "HandleSessionCreate failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<InsightIntentExecutorAsyncCallback> executorCallback = nullptr;
|
||||
executorCallback.reset(InsightIntentExecutorAsyncCallback::Create());
|
||||
if (executorCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Create async callback failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Create async callback failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto uiExtension = std::static_pointer_cast<JsUIExtension>(shared_from_this());
|
||||
executorCallback->Push([uiExtension, sessionInfo, needForeground](AppExecFwk::InsightIntentExecuteResult result) {
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Execute post insightintent.");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Execute post insightintent");
|
||||
if (uiExtension == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "UI extension is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "UI extension is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -503,10 +503,10 @@ bool JsUIExtension::ForegroundWindowWithInsightIntent(const AAFwk::Want &want,
|
||||
int32_t ret = DelayedSingleton<InsightIntentExecutorMgr>::GetInstance()->ExecuteInsightIntent(
|
||||
jsRuntime_, executorInfo, std::move(executorCallback));
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Execute insight intent failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Execute insight intent failed");
|
||||
// callback has removed, release in insight intent executor.
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -514,7 +514,7 @@ void JsUIExtension::PostInsightIntentExecuted(const sptr<AAFwk::SessionInfo> &se
|
||||
const AppExecFwk::InsightIntentExecuteResult &result, bool needForeground)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Post insightintent executed.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Post insightintent executed");
|
||||
if (needForeground) {
|
||||
// If uiextensionability is started for the first time or need move background to foreground.
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
@ -555,7 +555,7 @@ void JsUIExtension::OnCommandWindowDone(const sptr<AAFwk::SessionInfo> &sessionI
|
||||
}
|
||||
AAFwk::AbilityManagerClient::GetInstance()->ScheduleCommandAbilityWindowDone(
|
||||
context->GetToken(), sessionInfo, winCmd, abilityCmd);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtension::OnInsightIntentExecuteDone(const sptr<AAFwk::SessionInfo> &sessionInfo,
|
||||
@ -563,11 +563,11 @@ void JsUIExtension::OnInsightIntentExecuteDone(const sptr<AAFwk::SessionInfo> &s
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo");
|
||||
return;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(uiWindowMutex_);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64 ".", sessionInfo->uiExtensionComponentId);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64, sessionInfo->uiExtensionComponentId);
|
||||
auto componentId = sessionInfo->uiExtensionComponentId;
|
||||
auto res = uiWindowMap_.find(componentId);
|
||||
if (res != uiWindowMap_.end() && res->second != nullptr) {
|
||||
@ -596,13 +596,13 @@ void JsUIExtension::OnInsightIntentExecuteDone(const sptr<AAFwk::SessionInfo> &s
|
||||
res->second->Show();
|
||||
foregroundWindows_.emplace(componentId);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtension::OnCommand(const AAFwk::Want &want, bool restart, int startId)
|
||||
{
|
||||
Extension::OnCommand(want, restart, startId);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnCommand begin restart=%{public}s,startId=%{public}d.",
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "restart=%{public}s, startId=%{public}d",
|
||||
restart ? "true" : "false", startId);
|
||||
// wrap want
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
@ -613,13 +613,13 @@ void JsUIExtension::OnCommand(const AAFwk::Want &want, bool restart, int startId
|
||||
napi_create_int32(env, startId, &napiStartId);
|
||||
napi_value argv[] = {napiWant, napiStartId};
|
||||
CallObjectMethod("onRequest", argv, ARGC_TWO);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnCommand end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtension::OnForeground(const Want &want, sptr<AAFwk::SessionInfo> sessionInfo)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnForeground begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
Extension::OnForeground(want, sessionInfo);
|
||||
|
||||
if (InsightIntentExecuteParam::IsInsightIntentExecute(want)) {
|
||||
@ -632,35 +632,35 @@ void JsUIExtension::OnForeground(const Want &want, sptr<AAFwk::SessionInfo> sess
|
||||
ForegroundWindow(want, sessionInfo);
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
CallObjectMethod("onForeground");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnForeground end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtension::OnBackground()
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnBackground begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
CallObjectMethod("onBackground");
|
||||
Extension::OnBackground();
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension OnBackground end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
bool JsUIExtension::HandleSessionCreate(const AAFwk::Want &want, const sptr<AAFwk::SessionInfo> &sessionInfo)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (sessionInfo == nullptr || sessionInfo->uiExtensionComponentId == 0) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo");
|
||||
return false;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(uiWindowMutex_);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64 ", element: %{public}s.",
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64 ", element: %{public}s",
|
||||
sessionInfo->uiExtensionComponentId, want.GetElement().GetURI().c_str());
|
||||
auto compId = sessionInfo->uiExtensionComponentId;
|
||||
if (uiWindowMap_.find(compId) == uiWindowMap_.end()) {
|
||||
auto context = GetContext();
|
||||
auto uiWindow = CreateUIWindow(context, sessionInfo);
|
||||
if (uiWindow == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "create ui window error.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "create ui window error");
|
||||
return false;
|
||||
}
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
@ -676,7 +676,7 @@ bool JsUIExtension::HandleSessionCreate(const AAFwk::Want &want, const sptr<AAFw
|
||||
screenMode_ = AAFwk::EMBEDDED_FULL_SCREEN_MODE;
|
||||
auto jsAppWindowStage = CreateAppWindowStage(uiWindow, sessionInfo);
|
||||
if (jsAppWindowStage == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "JsAppWindowStage is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "JsAppWindowStage is nullptr");
|
||||
return false;
|
||||
}
|
||||
napi_value argv[] = {jsAppWindowStage->GetNapiValue()};
|
||||
@ -728,7 +728,7 @@ void JsUIExtension::ForegroundWindow(const AAFwk::Want &want, const sptr<AAFwk::
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (!HandleSessionCreate(want, sessionInfo)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "HandleSessionCreate failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "HandleSessionCreate failed");
|
||||
return;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(uiWindowMutex_);
|
||||
@ -740,14 +740,14 @@ void JsUIExtension::ForegroundWindow(const AAFwk::Want &want, const sptr<AAFwk::
|
||||
uiWindow->Show();
|
||||
foregroundWindows_.emplace(componentId);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtension::BackgroundWindow(const sptr<AAFwk::SessionInfo> &sessionInfo)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo");
|
||||
return;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(uiWindowMutex_);
|
||||
@ -763,14 +763,14 @@ void JsUIExtension::BackgroundWindow(const sptr<AAFwk::SessionInfo> &sessionInfo
|
||||
uiWindow->Hide();
|
||||
foregroundWindows_.erase(componentId);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtension::DestroyWindow(const sptr<AAFwk::SessionInfo> &sessionInfo)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo");
|
||||
return;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(uiWindowMutex_);
|
||||
@ -811,12 +811,12 @@ void JsUIExtension::DestroyWindow(const sptr<AAFwk::SessionInfo> &sessionInfo)
|
||||
if (abilityResultListeners_) {
|
||||
abilityResultListeners_->RemoveListener(componentId);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
napi_value JsUIExtension::CallObjectMethod(const char *name, napi_value const *argv, size_t argc, bool withResult)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension CallObjectMethod(%{public}s), begin", name);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "%{public}s, begin", name);
|
||||
|
||||
if (!jsObj_) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not found UIExtension.js");
|
||||
@ -852,7 +852,7 @@ napi_value JsUIExtension::CallOnConnect(const AAFwk::Want &want)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
Extension::OnConnect(want);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension CallOnConnect begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension CallOnConnect begin");
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
napi_value napiWant = OHOS::AppExecFwk::WrapWant(env, want);
|
||||
@ -877,9 +877,9 @@ napi_value JsUIExtension::CallOnConnect(const AAFwk::Want &want)
|
||||
napi_value remoteNative = nullptr;
|
||||
napi_call_function(env, obj, method, ARGC_ONE, argv, &remoteNative);
|
||||
if (remoteNative == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "remoteNative is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "remoteNative is nullptr");
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtension CallOnConnect end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
return remoteNative;
|
||||
}
|
||||
|
||||
@ -938,7 +938,7 @@ void JsUIExtension::OnConfigurationUpdated(const AppExecFwk::Configuration& conf
|
||||
|
||||
auto fullConfig = context->GetConfiguration();
|
||||
if (!fullConfig) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "configuration is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "configuration is nullptr");
|
||||
return;
|
||||
}
|
||||
JsExtensionContext::ConfigurationUpdated(env, shellContextRef_, fullConfig);
|
||||
@ -980,7 +980,7 @@ void JsUIExtension::Dump(const std::vector<std::string> ¶ms, std::vector<std
|
||||
napi_value dumpInfo = nullptr;
|
||||
napi_call_function(env, obj, method, ARGC_ONE, argv, &dumpInfo);
|
||||
if (dumpInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "dumpInfo is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "dumpInfo is nullptr");
|
||||
return;
|
||||
}
|
||||
uint32_t len = 0;
|
||||
@ -990,7 +990,7 @@ void JsUIExtension::Dump(const std::vector<std::string> ¶ms, std::vector<std
|
||||
napi_value element = nullptr;
|
||||
napi_get_element(env, dumpInfo, i, &element);
|
||||
if (!ConvertFromJsValue(env, element, dumpInfoStr)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Parse dumpInfoStr fail.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Parse dumpInfoStr fail");
|
||||
return;
|
||||
}
|
||||
info.push_back(dumpInfoStr);
|
||||
@ -1000,11 +1000,11 @@ void JsUIExtension::Dump(const std::vector<std::string> ¶ms, std::vector<std
|
||||
|
||||
void JsUIExtension::OnAbilityResult(int requestCode, int resultCode, const Want &resultData)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
Extension::OnAbilityResult(requestCode, resultCode, resultData);
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "not attached to any runtime context!");
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "not attached to any runtime context");
|
||||
return;
|
||||
}
|
||||
context->OnAbilityResult(requestCode, resultCode, resultData);
|
||||
@ -1013,7 +1013,7 @@ void JsUIExtension::OnAbilityResult(int requestCode, int resultCode, const Want
|
||||
return;
|
||||
}
|
||||
abilityResultListeners_->OnAbilityResult(requestCode, resultCode, resultData);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,18 +52,18 @@ napi_value AttachUIExtensionBaseContext(napi_env env, void *value, void*)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
if (value == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "invalid parameter.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "invalid parameter");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto ptr = reinterpret_cast<std::weak_ptr<UIExtensionContext>*>(value)->lock();
|
||||
if (ptr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "invalid context.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "invalid context");
|
||||
return nullptr;
|
||||
}
|
||||
napi_value object = JsUIExtensionContext::CreateJsUIExtensionContext(env, ptr);
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "create context error.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "create context error");
|
||||
return nullptr;
|
||||
}
|
||||
auto contextRef = JsRuntime::LoadSystemModuleByEngine(
|
||||
@ -74,11 +74,11 @@ napi_value AttachUIExtensionBaseContext(napi_env env, void *value, void*)
|
||||
}
|
||||
auto contextObj = contextRef->GetNapiValue();
|
||||
if (contextObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "load context error.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "load context error");
|
||||
return nullptr;
|
||||
}
|
||||
if (!CheckTypeForNapiValue(env, contextObj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "not object.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "not object");
|
||||
return nullptr;
|
||||
}
|
||||
napi_coerce_to_native_binding_object(
|
||||
@ -105,7 +105,7 @@ JsUIExtensionBase::JsUIExtensionBase(const std::unique_ptr<Runtime> &runtime)
|
||||
|
||||
JsUIExtensionBase::~JsUIExtensionBase()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "destructor.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "destructor");
|
||||
jsRuntime_.FreeNativeReference(std::move(jsObj_));
|
||||
jsRuntime_.FreeNativeReference(std::move(shellContextRef_));
|
||||
for (auto &item : contentSessions_) {
|
||||
@ -170,10 +170,10 @@ void JsUIExtensionBase::BindContext()
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "context_ is nullptr");
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "BindContext CreateJsUIExtensionContext.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "BindContext CreateJsUIExtensionContext");
|
||||
napi_value contextObj = JsUIExtensionContext::CreateJsUIExtensionContext(env, context_);
|
||||
if (contextObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Create js ui extension context error.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Create js ui extension context error");
|
||||
return;
|
||||
}
|
||||
shellContextRef_ = JsRuntime::LoadSystemModuleByEngine(
|
||||
@ -235,7 +235,7 @@ void JsUIExtensionBase::OnCommandWindow(
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
if (sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "sessionInfo is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "sessionInfo is nullptr");
|
||||
return;
|
||||
}
|
||||
if (InsightIntentExecuteParam::IsInsightIntentExecute(want) && winCmd == AAFwk::WIN_CMD_FOREGROUND) {
|
||||
@ -255,7 +255,7 @@ void JsUIExtensionBase::OnCommandWindow(
|
||||
DestroyWindow(sessionInfo);
|
||||
break;
|
||||
default:
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "unsupported cmd.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "unsupported cmd");
|
||||
break;
|
||||
}
|
||||
OnCommandWindowDone(sessionInfo, winCmd);
|
||||
@ -267,22 +267,22 @@ bool JsUIExtensionBase::ForegroundWindowWithInsightIntent(const AAFwk::Want &wan
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
if (!HandleSessionCreate(want, sessionInfo)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "HandleSessionCreate failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "HandleSessionCreate failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<InsightIntentExecutorAsyncCallback> executorCallback = nullptr;
|
||||
executorCallback.reset(InsightIntentExecutorAsyncCallback::Create());
|
||||
if (executorCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Create async callback failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Create async callback failed");
|
||||
return false;
|
||||
}
|
||||
executorCallback->Push(
|
||||
[weak = weak_from_this(), sessionInfo, needForeground](AppExecFwk::InsightIntentExecuteResult result) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Begin UI extension transaction callback.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Begin UI extension transaction callback");
|
||||
auto extension = weak.lock();
|
||||
if (extension == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "UI extension is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "UI extension is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -306,10 +306,10 @@ bool JsUIExtensionBase::ForegroundWindowWithInsightIntent(const AAFwk::Want &wan
|
||||
int32_t ret = DelayedSingleton<InsightIntentExecutorMgr>::GetInstance()->ExecuteInsightIntent(
|
||||
jsRuntime_, executorInfo, std::move(executorCallback));
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Execute insight intent failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Execute insight intent failed");
|
||||
// callback has removed, release in insight intent executor.
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@ void JsUIExtensionBase::PostInsightIntentExecuted(const sptr<AAFwk::SessionInfo>
|
||||
const AppExecFwk::InsightIntentExecuteResult &result, bool needForeground)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Post insightintent executed.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Post insightintent executed");
|
||||
if (needForeground) {
|
||||
// If uiextensionability is started for the first time or need move background to foreground.
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
@ -356,7 +356,7 @@ void JsUIExtensionBase::OnCommandWindowDone(const sptr<AAFwk::SessionInfo> &sess
|
||||
}
|
||||
AAFwk::AbilityManagerClient::GetInstance()->ScheduleCommandAbilityWindowDone(
|
||||
context_->GetToken(), sessionInfo, winCmd, abilityCmd);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtensionBase::OnInsightIntentExecuteDone(const sptr<AAFwk::SessionInfo> &sessionInfo,
|
||||
@ -364,11 +364,11 @@ void JsUIExtensionBase::OnInsightIntentExecuteDone(const sptr<AAFwk::SessionInfo
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64 ".", sessionInfo->uiExtensionComponentId);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64, sessionInfo->uiExtensionComponentId);
|
||||
auto componentId = sessionInfo->uiExtensionComponentId;
|
||||
auto res = uiWindowMap_.find(componentId);
|
||||
if (res != uiWindowMap_.end() && res->second != nullptr) {
|
||||
@ -397,7 +397,7 @@ void JsUIExtensionBase::OnInsightIntentExecuteDone(const sptr<AAFwk::SessionInfo
|
||||
res->second->Show();
|
||||
foregroundWindows_.emplace(componentId);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtensionBase::OnCommand(const AAFwk::Want &want, bool restart, int32_t startId)
|
||||
@ -406,7 +406,7 @@ void JsUIExtensionBase::OnCommand(const AAFwk::Want &want, bool restart, int32_t
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
if (env == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "env is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "env is nullptr");
|
||||
return;
|
||||
}
|
||||
napi_value napiWant = OHOS::AppExecFwk::WrapWant(env, want);
|
||||
@ -454,7 +454,7 @@ bool JsUIExtensionBase::CallJsOnSessionCreate(const AAFwk::Want &want, const spt
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
if (env == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "env is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "env is nullptr");
|
||||
return false;
|
||||
}
|
||||
napi_value napiWant = OHOS::AppExecFwk::WrapWant(env, want);
|
||||
@ -481,14 +481,14 @@ bool JsUIExtensionBase::HandleSessionCreate(const AAFwk::Want &want, const sptr<
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (sessionInfo == nullptr || sessionInfo->uiExtensionComponentId == 0) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo");
|
||||
return false;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64 ", element: %{public}s.",
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64 ", element: %{public}s",
|
||||
sessionInfo->uiExtensionComponentId, want.GetElement().GetURI().c_str());
|
||||
if (sessionInfo == nullptr || sessionInfo->uiExtensionComponentId == 0) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo");
|
||||
return false;
|
||||
}
|
||||
auto componentId = sessionInfo->uiExtensionComponentId;
|
||||
@ -505,7 +505,7 @@ bool JsUIExtensionBase::HandleSessionCreate(const AAFwk::Want &want, const sptr<
|
||||
option->SetUIExtensionUsage(static_cast<uint32_t>(sessionInfo->uiExtensionUsage));
|
||||
auto uiWindow = Rosen::Window::Create(option, context_, sessionInfo->sessionToken);
|
||||
if (uiWindow == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "create ui window error.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "create ui window error");
|
||||
return false;
|
||||
}
|
||||
if (!CallJsOnSessionCreate(want, sessionInfo, uiWindow, componentId)) {
|
||||
@ -525,10 +525,10 @@ void JsUIExtensionBase::ForegroundWindow(const AAFwk::Want &want, const sptr<AAF
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (!HandleSessionCreate(want, sessionInfo)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "HandleSessionCreate failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "HandleSessionCreate failed");
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64 ".", sessionInfo->uiExtensionComponentId);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64, sessionInfo->uiExtensionComponentId);
|
||||
auto componentId = sessionInfo->uiExtensionComponentId;
|
||||
auto &uiWindow = uiWindowMap_[componentId];
|
||||
if (uiWindow) {
|
||||
@ -541,11 +541,11 @@ void JsUIExtensionBase::BackgroundWindow(const sptr<AAFwk::SessionInfo> &session
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64 ".", sessionInfo->uiExtensionComponentId);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64, sessionInfo->uiExtensionComponentId);
|
||||
auto componentId = sessionInfo->uiExtensionComponentId;
|
||||
if (uiWindowMap_.find(componentId) == uiWindowMap_.end()) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to find uiWindow");
|
||||
@ -562,11 +562,11 @@ void JsUIExtensionBase::DestroyWindow(const sptr<AAFwk::SessionInfo> &sessionInf
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid sessionInfo");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64 ".", sessionInfo->uiExtensionComponentId);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension component id: %{public}" PRId64, sessionInfo->uiExtensionComponentId);
|
||||
auto componentId = sessionInfo->uiExtensionComponentId;
|
||||
if (uiWindowMap_.find(componentId) == uiWindowMap_.end()) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to find uiWindow");
|
||||
@ -630,7 +630,7 @@ void JsUIExtensionBase::OnConfigurationUpdated(const AppExecFwk::Configuration &
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
auto fullConfig = context_->GetConfiguration();
|
||||
if (!fullConfig) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "configuration is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "configuration is nullptr");
|
||||
return;
|
||||
}
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
@ -639,7 +639,7 @@ void JsUIExtensionBase::OnConfigurationUpdated(const AppExecFwk::Configuration &
|
||||
napi_value napiConfiguration =
|
||||
OHOS::AppExecFwk::WrapConfiguration(env, *fullConfig);
|
||||
if (napiConfiguration == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get configuration.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get configuration");
|
||||
return;
|
||||
}
|
||||
CallObjectMethod("onConfigurationUpdate", &napiConfiguration, ARGC_ONE);
|
||||
@ -675,7 +675,7 @@ void JsUIExtensionBase::Dump(const std::vector<std::string> ¶ms, std::vector
|
||||
napi_value dumpInfo = nullptr;
|
||||
napi_call_function(env, obj, method, ARGC_ONE, argv, &dumpInfo);
|
||||
if (dumpInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "dumpInfo is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "dumpInfo is nullptr");
|
||||
return;
|
||||
}
|
||||
uint32_t len = 0;
|
||||
@ -697,7 +697,7 @@ void JsUIExtensionBase::OnAbilityResult(int32_t requestCode, int32_t resultCode,
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
if (context_ == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "not attached to any runtime context!");
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "not attached to any runtime context");
|
||||
return;
|
||||
}
|
||||
context_->OnAbilityResult(requestCode, resultCode, resultData);
|
||||
|
@ -68,7 +68,7 @@ void AbilityResultListeners::AddListener(const uint64_t &uiExtensionComponentId,
|
||||
std::shared_ptr<AbilityResultListener> listener)
|
||||
{
|
||||
if (uiExtensionComponentId == 0) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid session.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid session");
|
||||
return;
|
||||
}
|
||||
listeners_[uiExtensionComponentId] = listener;
|
||||
@ -93,7 +93,7 @@ void AbilityResultListeners::OnAbilityResult(int requestCode, int resultCode, co
|
||||
|
||||
void UISessionAbilityResultListener::OnAbilityResult(int requestCode, int resultCode, const Want &resultData)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
auto callback = resultCallbacks_.find(requestCode);
|
||||
if (callback != resultCallbacks_.end()) {
|
||||
if (callback->second) {
|
||||
@ -101,7 +101,7 @@ void UISessionAbilityResultListener::OnAbilityResult(int requestCode, int result
|
||||
}
|
||||
resultCallbacks_.erase(requestCode);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
bool UISessionAbilityResultListener::IsMatch(int requestCode)
|
||||
@ -111,7 +111,7 @@ bool UISessionAbilityResultListener::IsMatch(int requestCode)
|
||||
|
||||
void UISessionAbilityResultListener::OnAbilityResultInner(int requestCode, int resultCode, const Want &resultData)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
auto callback = resultCallbacks_.find(requestCode);
|
||||
if (callback != resultCallbacks_.end()) {
|
||||
if (callback->second) {
|
||||
@ -119,7 +119,7 @@ void UISessionAbilityResultListener::OnAbilityResultInner(int requestCode, int r
|
||||
}
|
||||
resultCallbacks_.erase(requestCode);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void UISessionAbilityResultListener::SaveResultCallbacks(int requestCode, RuntimeTask&& task)
|
||||
@ -149,7 +149,7 @@ JsUIExtensionContentSession::JsUIExtensionContentSession(
|
||||
|
||||
void JsUIExtensionContentSession::Finalizer(napi_env env, void* data, void* hint)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtensionContentSession Finalizer is called");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
std::unique_ptr<JsUIExtensionContentSession>(static_cast<JsUIExtensionContentSession*>(data));
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ napi_value JsUIExtensionContentSession::StartAbilityByType(napi_env env, napi_ca
|
||||
napi_value JsUIExtensionContentSession::OnStartAbility(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStartAbility is called");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
CHECK_IS_SYSTEM_APP;
|
||||
|
||||
if (info.argc == ARGC_ZERO) {
|
||||
@ -238,14 +238,14 @@ napi_value JsUIExtensionContentSession::OnStartAbility(napi_env env, NapiCallbac
|
||||
AAFwk::Want want;
|
||||
size_t unwrapArgc = 1;
|
||||
if (!OHOS::AppExecFwk::UnwrapWant(env, info.argv[0], want)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to parse want!");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to parse want");
|
||||
ThrowInvalidParamError(env, "Parameter error: Failed to parse want! Want must be a Want.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
if (!want.HasParameter(Want::PARAM_BACK_TO_OTHER_MISSION_STACK)) {
|
||||
want.SetParam(Want::PARAM_BACK_TO_OTHER_MISSION_STACK, true);
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "StartAbility, ability:%{public}s.", want.GetElement().GetAbilityName().c_str());
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "StartAbility, ability:%{public}s", want.GetElement().GetAbilityName().c_str());
|
||||
auto innerErrorCode = std::make_shared<int>(ERR_OK);
|
||||
NapiAsyncTask::ExecuteCallback execute = StartAbilityExecuteCallback(
|
||||
want, unwrapArgc, env, info, innerErrorCode);
|
||||
@ -268,13 +268,13 @@ napi_value JsUIExtensionContentSession::OnStartAbility(napi_env env, NapiCallbac
|
||||
NapiAsyncTask::Schedule("JsUIExtensionContentSession::OnStartAbility", env,
|
||||
CreateAsyncTaskWithLastParam(env, lastParam, std::move(execute), std::move(complete), &result));
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStartAbility is called end");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value JsUIExtensionContentSession::OnGetUIExtensionHostWindowProxy(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnGetUIExtensionHostWindowProxy is called");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
CHECK_IS_SYSTEM_APP;
|
||||
if (sessionInfo_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid session info");
|
||||
@ -285,7 +285,7 @@ napi_value JsUIExtensionContentSession::OnGetUIExtensionHostWindowProxy(napi_env
|
||||
napi_value jsExtensionWindow =
|
||||
Rosen::JsExtensionWindow::CreateJsExtensionWindow(env, uiWindow_, sessionInfo_->hostWindowId);
|
||||
if (jsExtensionWindow == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to create jsExtensionWindow object.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to create jsExtensionWindow object");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INNER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -309,7 +309,7 @@ napi_value JsUIExtensionContentSession::OnGetUIExtensionWindowProxy(napi_env env
|
||||
napi_value jsExtensionWindow =
|
||||
Rosen::JsExtensionWindow::CreateJsExtensionWindow(env, uiWindow_, sessionInfo_->hostWindowId);
|
||||
if (jsExtensionWindow == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to create jsExtensionWindow object.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to create jsExtensionWindow object");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INNER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -332,14 +332,14 @@ napi_value JsUIExtensionContentSession::OnStartAbilityAsCaller(napi_env env, Nap
|
||||
AAFwk::Want want;
|
||||
bool unWrapWantFlag = OHOS::AppExecFwk::UnwrapWant(env, info.argv[0], want);
|
||||
if (!unWrapWantFlag) {
|
||||
ThrowInvalidParamError(env, "Parameter error: Parse want failed! Want must be a Want.");
|
||||
ThrowInvalidParamError(env, "Parameter error: Parse want failed! Want must be a Want");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
decltype(info.argc) unwrapArgc = 1;
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "StartAbilityAsCaller, ability:%{public}s.", want.GetElement().GetAbilityName().c_str());
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "StartAbilityAsCaller, ability:%{public}s", want.GetElement().GetAbilityName().c_str());
|
||||
AAFwk::StartOptions startOptions;
|
||||
if (info.argc > ARGC_ONE && CheckTypeForNapiValue(env, info.argv[INDEX_ONE], napi_object)) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStartAbilityAsCaller start options is used.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStartAbilityAsCaller start options is used");
|
||||
AppExecFwk::UnwrapStartOptions(env, info.argv[INDEX_ONE], startOptions);
|
||||
unwrapArgc++;
|
||||
}
|
||||
@ -378,7 +378,7 @@ NapiAsyncTask::ExecuteCallback JsUIExtensionContentSession::StartAbilityExecuteC
|
||||
{
|
||||
AAFwk::StartOptions startOptions;
|
||||
if (info.argc > ARGC_ONE && CheckTypeForNapiValue(env, info.argv[1], napi_object)) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStartAbility start options is used.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStartAbility start options is used");
|
||||
bool unWrapStartOptionsFlag = AppExecFwk::UnwrapStartOptions(env, info.argv[1], startOptions);
|
||||
if (!unWrapStartOptionsFlag) {
|
||||
ThrowInvalidParamError(env, "Parameter error: Parse startOptions failed! Options must be a StartOption.");
|
||||
@ -426,7 +426,7 @@ napi_value JsUIExtensionContentSession::OnStartAbilityForResult(napi_env env, Na
|
||||
|
||||
AAFwk::Want want;
|
||||
if (!AppExecFwk::UnwrapWant(env, info.argv[0], want)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Error to parse want!");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Error to parse want");
|
||||
ThrowInvalidParamError(env, "Failed to parse want! Want must be a Want.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -436,10 +436,10 @@ napi_value JsUIExtensionContentSession::OnStartAbilityForResult(napi_env env, Na
|
||||
size_t unwrapArgc = 1;
|
||||
AAFwk::StartOptions startOptions;
|
||||
if (info.argc > ARGC_ONE && CheckTypeForNapiValue(env, info.argv[1], napi_object)) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStartAbilityForResult start options is used.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStartAbilityForResult start options is used");
|
||||
bool unWrapStartOptionsFlag = AppExecFwk::UnwrapStartOptions(env, info.argv[1], startOptions);
|
||||
if (!unWrapStartOptionsFlag) {
|
||||
ThrowInvalidParamError(env, "Parameter error: Parse startOptions failed! Options must be a StartOption.");
|
||||
ThrowInvalidParamError(env, "Parameter error: Parse startOptions failed! Options must be a StartOption");
|
||||
}
|
||||
unwrapArgc++;
|
||||
}
|
||||
@ -525,7 +525,7 @@ void JsUIExtensionContentSession::StartAbilityForResultRuntimeTask(napi_env env,
|
||||
|
||||
napi_value JsUIExtensionContentSession::OnTerminateSelf(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "OnTerminateSelf called");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "called");
|
||||
NapiAsyncTask::CompleteCallback complete =
|
||||
[sessionInfo = sessionInfo_](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
if (sessionInfo == nullptr) {
|
||||
@ -551,14 +551,14 @@ napi_value JsUIExtensionContentSession::OnTerminateSelfWithResult(napi_env env,
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "called");
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
int resultCode = 0;
|
||||
AAFwk::Want want;
|
||||
if (!AppExecFwk::UnWrapAbilityResult(env, info.argv[INDEX_ZERO], resultCode, want)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnTerminateSelfWithResult Failed to parse ability result!");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnTerminateSelfWithResult Failed to parse ability result");
|
||||
ThrowInvalidParamError(env, "Parameter error: Failed to parse parameter! Parameter must be a AbilityResult.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -578,13 +578,13 @@ napi_value JsUIExtensionContentSession::OnSendData(napi_env env, NapiCallbackInf
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
CHECK_IS_SYSTEM_APP;
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
AAFwk::WantParams params;
|
||||
if (!AppExecFwk::UnwrapWantParams(env, info.argv[INDEX_ZERO], params)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnSendData Failed to parse param!");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnSendData Failed to parse param");
|
||||
ThrowInvalidParamError(env, "OnSendData Failed to parse param! Data must be a Record<string, Object>.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -610,14 +610,14 @@ napi_value JsUIExtensionContentSession::OnSetReceiveDataCallback(napi_env env, N
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
CHECK_IS_SYSTEM_APP;
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
if (!CheckTypeForNapiValue(env, info.argv[INDEX_ZERO], napi_function)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "invalid param");
|
||||
ThrowInvalidParamError(env, "Parameter error: Callback must be a function.");
|
||||
ThrowInvalidParamError(env, "Parameter error: Callback must be a function");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
@ -658,7 +658,7 @@ napi_value JsUIExtensionContentSession::OnSetReceiveDataForResultCallback(napi_e
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
CHECK_IS_SYSTEM_APP;
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -710,7 +710,7 @@ napi_value JsUIExtensionContentSession::OnLoadContent(napi_env env, NapiCallback
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
std::string contextPath;
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -759,7 +759,7 @@ napi_value JsUIExtensionContentSession::OnSetWindowBackgroundColor(napi_env env,
|
||||
CHECK_IS_SYSTEM_APP;
|
||||
std::string color;
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -790,7 +790,7 @@ napi_value JsUIExtensionContentSession::OnSetWindowPrivacyMode(napi_env env, Nap
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
bool isPrivacyMode = false;
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Not enough params");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -835,7 +835,7 @@ napi_value JsUIExtensionContentSession::OnStartAbilityByType(napi_env env, NapiC
|
||||
|
||||
bool checkResult = CheckStartAbilityByTypeParam(env, info, type, wantParam);
|
||||
if (!checkResult) {
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "check startAbilityByCall param failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "check startAbilityByCall param failed");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
@ -889,13 +889,13 @@ bool JsUIExtensionContentSession::CheckStartAbilityByTypeParam(napi_env env,
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "start");
|
||||
|
||||
if (info.argc < ARGC_THREE) {
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "Not enough params.");
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "Not enough params");
|
||||
ThrowTooFewParametersError(env);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ConvertFromJsValue(env, info.argv[INDEX_ZERO], type)) {
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "Failed to parse type!");
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "Failed to parse type");
|
||||
ThrowInvalidParamError(env, "Parameter error: Failed to parse type! Type must be a string.");
|
||||
return false;
|
||||
}
|
||||
@ -1042,7 +1042,7 @@ void JsUIExtensionContentSession::CallReceiveDataCallbackForResult(napi_env env,
|
||||
}
|
||||
|
||||
if (!AppExecFwk::UnwrapWantParams(env, ret, retWantParams)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to parse param!");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to parse param");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1066,7 +1066,7 @@ void JsUIExtensionContentSession::AddFreeInstallObserver(napi_env env,
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "AddFreeInstallObserver failed");
|
||||
} else {
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "AddJsObserverObject.");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "AddJsObserverObject");
|
||||
// build a callback observer with last param
|
||||
std::string bundleName = want.GetElement().GetBundleName();
|
||||
std::string abilityName = want.GetElement().GetAbilityName();
|
||||
@ -1091,7 +1091,7 @@ void JsUIExtensionContentSession::SetCallbackForTerminateWithResult(int32_t resu
|
||||
}
|
||||
|
||||
if (uiWindow == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "uiWindow is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "uiWindow is nullptr");
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INNER));
|
||||
return;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ void RemoveConnection(int64_t connectId)
|
||||
|
||||
void FindConnection(AAFwk::Want& want, sptr<JSUIExtensionConnection>& connection, int64_t& connectId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Disconnect ability enter, connection:%{public}d.", static_cast<int32_t>(connectId));
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Disconnect ability enter, connection:%{public}d", static_cast<int32_t>(connectId));
|
||||
auto item = std::find_if(g_connects.begin(),
|
||||
g_connects.end(),
|
||||
[&connectId](const auto &obj) {
|
||||
@ -115,7 +115,7 @@ bool CheckConnectionParam(napi_env env, napi_value value, sptr<JSUIExtensionConn
|
||||
|
||||
void JsUIExtensionContext::Finalizer(napi_env env, void* data, void* hint)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtensionContext Finalizer is called");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
std::unique_ptr<JsUIExtensionContext>(static_cast<JsUIExtensionContext*>(data));
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ napi_value JsUIExtensionContext::DisconnectUIServiceExtension(napi_env env, napi
|
||||
napi_value JsUIExtensionContext::OnStartAbility(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStartAbility is called");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
@ -199,7 +199,7 @@ napi_value JsUIExtensionContext::OnStartAbility(napi_env env, NapiCallbackInfo&
|
||||
AAFwk::StartOptions startOptions;
|
||||
if (!CheckStartAbilityInputParam(env, info, want, startOptions, unwrapArgc)) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Failed, input param type invalid");
|
||||
ThrowInvalidParamError(env, "Parse param want failed, want must be Want.");
|
||||
ThrowInvalidParamError(env, "Parse param want failed, want must be Want");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ static bool ParseOpenLinkParams(const napi_env &env, const NapiCallbackInfo &inf
|
||||
}
|
||||
|
||||
if (CheckTypeForNapiValue(env, info.argv[INDEX_ONE], napi_object)) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OpenLinkOptions is used.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OpenLinkOptions is used");
|
||||
if (!AppExecFwk::UnwrapOpenLinkOptions(env, info.argv[INDEX_ONE], openLinkOptions, want)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "openLinkOptions parse failed");
|
||||
return false;
|
||||
@ -338,7 +338,7 @@ napi_value JsUIExtensionContext::OnOpenLink(napi_env env, NapiCallbackInfo& info
|
||||
|
||||
int requestCode = -1;
|
||||
if (CheckTypeForNapiValue(env, info.argv[INDEX_TWO], napi_function)) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "completionHandler is used.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "completionHandler is used");
|
||||
CreateOpenLinkTask(env, info.argv[INDEX_TWO], want, requestCode);
|
||||
}
|
||||
return OnOpenLinkInner(env, want, requestCode, startTime, linkValue);
|
||||
@ -361,20 +361,20 @@ napi_value JsUIExtensionContext::OnOpenLinkInner(napi_env env, const AAFwk::Want
|
||||
NapiAsyncTask::CompleteCallback complete = [innerErrorCode, requestCode, startTime, url, this](
|
||||
napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
if (*innerErrorCode == 0) {
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "OpenLink succeeded.");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "OpenLink succeeded");
|
||||
return;
|
||||
}
|
||||
if (freeInstallObserver_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "freeInstallObserver_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "freeInstallObserver_ is nullptr");
|
||||
RemoveOpenLinkTask(requestCode);
|
||||
return;
|
||||
}
|
||||
if (*innerErrorCode == AAFwk::ERR_OPEN_LINK_START_ABILITY_DEFAULT_OK) {
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "start ability by default succeeded.");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "start ability by default succeeded");
|
||||
freeInstallObserver_->OnInstallFinishedByUrl(startTime, url, ERR_OK);
|
||||
return;
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "OpenLink failed.");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "OpenLink failed");
|
||||
freeInstallObserver_->OnInstallFinishedByUrl(startTime, url, *innerErrorCode);
|
||||
RemoveOpenLinkTask(requestCode);
|
||||
};
|
||||
@ -389,7 +389,7 @@ napi_value JsUIExtensionContext::OnOpenLinkInner(napi_env env, const AAFwk::Want
|
||||
|
||||
napi_value JsUIExtensionContext::OnTerminateSelf(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "OnTerminateSelf is called");
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "called");
|
||||
NapiAsyncTask::CompleteCallback complete =
|
||||
[weak = context_](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto context = weak.lock();
|
||||
@ -437,7 +437,7 @@ napi_value JsUIExtensionContext::OnStartAbilityForResult(napi_env env, NapiCallb
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "called");
|
||||
napi_value abilityResult = AppExecFwk::WrapAbilityResult(env, resultCode, want);
|
||||
if (abilityResult == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "wrap abilityResult failed.");
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "wrap abilityResult failed");
|
||||
asyncTask->Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INNER));
|
||||
return;
|
||||
}
|
||||
@ -449,7 +449,7 @@ napi_value JsUIExtensionContext::OnStartAbilityForResult(napi_env env, NapiCallb
|
||||
};
|
||||
auto context = context_.lock();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "context is released.");
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "context is released");
|
||||
asyncTask->Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT));
|
||||
return result;
|
||||
}
|
||||
@ -457,7 +457,7 @@ napi_value JsUIExtensionContext::OnStartAbilityForResult(napi_env env, NapiCallb
|
||||
int curRequestCode = context->GenerateCurRequestCode();
|
||||
(unwrapArgc == INDEX_ONE) ? context->StartAbilityForResult(want, curRequestCode, std::move(task))
|
||||
: context->StartAbilityForResult(want, startOptions, curRequestCode, std::move(task));
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStartAbilityForResult end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnStartAbilityForResult end");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -472,7 +472,7 @@ napi_value JsUIExtensionContext::OnTerminateSelfWithResult(napi_env env, NapiCal
|
||||
int32_t resultCode = 0;
|
||||
AAFwk::Want want;
|
||||
if (!AppExecFwk::UnWrapAbilityResult(env, info.argv[INDEX_ZERO], resultCode, want)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnTerminateSelfWithResult Failed to parse ability result!");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnTerminateSelfWithResult Failed to parse ability result");
|
||||
ThrowInvalidParamError(env, "Parse param want failed, want must be Want.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -483,7 +483,7 @@ napi_value JsUIExtensionContext::OnTerminateSelfWithResult(napi_env env, NapiCal
|
||||
napi_value result = nullptr;
|
||||
NapiAsyncTask::ScheduleHighQos("JsUIExtensionContext::OnTerminateSelfWithResult",
|
||||
env, CreateAsyncTaskWithLastParam(env, lastParam, nullptr, std::move(complete), &result));
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnTerminateSelfWithResult is called end");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -499,7 +499,7 @@ napi_value JsUIExtensionContext::OnStartAbilityForResultAsCaller(napi_env env, N
|
||||
AAFwk::StartOptions startOptions;
|
||||
if (!CheckStartAbilityInputParam(env, info, want, startOptions, unwrapArgc)) {
|
||||
ThrowInvalidParamError(env, "Parse param want failed, want must be Want.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Input param type invalid.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Input param type invalid");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
napi_value result = nullptr;
|
||||
@ -509,7 +509,7 @@ napi_value JsUIExtensionContext::OnStartAbilityForResultAsCaller(napi_env env, N
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "called");
|
||||
napi_value abilityResult = AppExecFwk::WrapAbilityResult(env, resultCode, want);
|
||||
if (abilityResult == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "Wrap abilityResult failed.");
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "Wrap abilityResult failed");
|
||||
asyncTask->Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INNER));
|
||||
return;
|
||||
}
|
||||
@ -521,7 +521,7 @@ napi_value JsUIExtensionContext::OnStartAbilityForResultAsCaller(napi_env env, N
|
||||
};
|
||||
auto context = context_.lock();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "The context is released.");
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "The context is released");
|
||||
asyncTask->Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT));
|
||||
return result;
|
||||
}
|
||||
@ -562,7 +562,7 @@ napi_value JsUIExtensionContext::OnConnectAbility(napi_env env, NapiCallbackInfo
|
||||
RemoveConnection(connectId);
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "ConnectAbility connection:%{public}d.", static_cast<int32_t>(connectId));
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "ConnectAbility connection:%{public}d", static_cast<int32_t>(connectId));
|
||||
auto innerErrorCode = context->ConnectAbility(want, connection);
|
||||
int32_t errcode = static_cast<int32_t>(AbilityRuntime::GetJsErrorCodeByNativeError(innerErrorCode));
|
||||
if (errcode) {
|
||||
@ -579,7 +579,7 @@ napi_value JsUIExtensionContext::OnConnectAbility(napi_env env, NapiCallbackInfo
|
||||
|
||||
napi_value JsUIExtensionContext::OnDisconnectAbility(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "DisconnectAbility start");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "start");
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
@ -588,7 +588,7 @@ napi_value JsUIExtensionContext::OnDisconnectAbility(napi_env env, NapiCallbackI
|
||||
int64_t connectId = -1;
|
||||
if (!AppExecFwk::UnwrapInt64FromJS2(env, info.argv[INDEX_ZERO], connectId)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Invalid connectId");
|
||||
ThrowInvalidParamError(env, "Parse param connectId failed, connectId must be number.");
|
||||
ThrowInvalidParamError(env, "Parse param connectId failed, connectId must be number");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
@ -601,7 +601,7 @@ napi_value JsUIExtensionContext::OnDisconnectAbility(napi_env env, NapiCallbackI
|
||||
napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "context is released.");
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "context is released");
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT));
|
||||
return;
|
||||
}
|
||||
@ -610,7 +610,7 @@ napi_value JsUIExtensionContext::OnDisconnectAbility(napi_env env, NapiCallbackI
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INNER));
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "context->DisconnectAbility.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "context->DisconnectAbility");
|
||||
auto innerErrorCode = context->DisconnectAbility(want, connection);
|
||||
if (innerErrorCode == 0) {
|
||||
task.Resolve(env, CreateJsUndefined(env));
|
||||
@ -863,7 +863,7 @@ napi_value JsUIExtensionContext::OnReportDrawnCompleted(napi_env env, NapiCallba
|
||||
|
||||
napi_value JsUIExtensionContext::OnOpenAtomicService(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnOpenAtomicService start");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "start");
|
||||
if (info.argc == ARGC_ZERO) {
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
@ -871,7 +871,7 @@ napi_value JsUIExtensionContext::OnOpenAtomicService(napi_env env, NapiCallbackI
|
||||
|
||||
std::string appId;
|
||||
if (!ConvertFromJsValue(env, info.argv[INDEX_ZERO], appId)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnOpenAtomicService, parse appId failed.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnOpenAtomicService, parse appId failed");
|
||||
ThrowInvalidParamError(env, "Parse param appId failed, appId must be string.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -880,9 +880,9 @@ napi_value JsUIExtensionContext::OnOpenAtomicService(napi_env env, NapiCallbackI
|
||||
Want want;
|
||||
AAFwk::StartOptions startOptions;
|
||||
if (info.argc > ARGC_ONE && CheckTypeForNapiValue(env, info.argv[INDEX_ONE], napi_object)) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnOpenAtomicService atomic service options is used.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnOpenAtomicService atomic service options is used");
|
||||
if (!AppExecFwk::UnwrapStartOptionsAndWant(env, info.argv[INDEX_ONE], startOptions, want)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to parse atomic service options.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to parse atomic service options");
|
||||
ThrowInvalidParamError(env,
|
||||
"Parse param startOptions failed, startOptions must be StartOption.");
|
||||
return CreateJsUndefined(env);
|
||||
@ -891,7 +891,7 @@ napi_value JsUIExtensionContext::OnOpenAtomicService(napi_env env, NapiCallbackI
|
||||
}
|
||||
|
||||
std::string bundleName = ATOMIC_SERVICE_PREFIX + appId;
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "bundleName: %{public}s.", bundleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "bundleName: %{public}s", bundleName.c_str());
|
||||
want.SetBundle(bundleName);
|
||||
return OpenAtomicServiceInner(env, info, want, startOptions, unwrapArgc);
|
||||
}
|
||||
@ -950,7 +950,7 @@ napi_value JsUIExtensionContext::OpenAtomicServiceInner(napi_env env, NapiCallba
|
||||
int resultCode, const AAFwk::Want& want, bool isInner) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnOpenAtomicService async callback is begin");
|
||||
if (observer == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "observer is nullptr.");
|
||||
TAG_LOGW(AAFwkTag::UI_EXT, "observer is nullptr");
|
||||
return;
|
||||
}
|
||||
HandleScope handleScope(env);
|
||||
@ -978,7 +978,7 @@ napi_value JsUIExtensionContext::OpenAtomicServiceInner(napi_env env, NapiCallba
|
||||
auto curRequestCode = context->GenerateCurRequestCode();
|
||||
context->OpenAtomicService(want, options, curRequestCode, std::move(task));
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnOpenAtomicService is called end");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -986,7 +986,7 @@ void JsUIExtensionContext::AddFreeInstallObserver(napi_env env, const AAFwk::Wan
|
||||
napi_value *result, bool isAbilityResult, bool isOpenLink)
|
||||
{
|
||||
// adapter free install async return install and start result
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "ConvertWindowSize begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
int ret = 0;
|
||||
if (freeInstallObserver_ == nullptr) {
|
||||
freeInstallObserver_ = new JsFreeInstallObserver(env);
|
||||
@ -999,7 +999,7 @@ void JsUIExtensionContext::AddFreeInstallObserver(napi_env env, const AAFwk::Wan
|
||||
}
|
||||
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "AddFreeInstallObserver error.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "AddFreeInstallObserver error");
|
||||
}
|
||||
std::string startTime = want.GetStringParam(Want::PARAM_RESV_START_TIME);
|
||||
if (!isOpenLink) {
|
||||
@ -1016,7 +1016,7 @@ void JsUIExtensionContext::AddFreeInstallObserver(napi_env env, const AAFwk::Wan
|
||||
napi_value JsUIExtensionContext::CreateJsUIExtensionContext(napi_env env,
|
||||
std::shared_ptr<UIExtensionContext> context)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "CreateJsUIExtensionContext begin");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo = nullptr;
|
||||
if (context) {
|
||||
abilityInfo = context->GetAbilityInfo();
|
||||
@ -1133,7 +1133,7 @@ int64_t JSUIExtensionConnection::GetConnectionId()
|
||||
void JSUIExtensionConnection::OnAbilityConnectDone(const AppExecFwk::ElementName &element,
|
||||
const sptr<IRemoteObject> &remoteObject, int resultCode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnAbilityConnectDone, resultCode:%{public}d", resultCode);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "resultCode:%{public}d", resultCode);
|
||||
wptr<JSUIExtensionConnection> connection = this;
|
||||
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback>
|
||||
([connection, element, remoteObject, resultCode](napi_env env, NapiAsyncTask &task, int32_t status) {
|
||||
@ -1154,7 +1154,7 @@ void JSUIExtensionConnection::OnAbilityConnectDone(const AppExecFwk::ElementName
|
||||
void JSUIExtensionConnection::HandleOnAbilityConnectDone(const AppExecFwk::ElementName &element,
|
||||
const sptr<IRemoteObject> &remoteObject, int resultCode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "HandleOnAbilityConnectDone start, resultCode:%{public}d", resultCode);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "start, resultCode:%{public}d", resultCode);
|
||||
// wrap ElementName
|
||||
napi_value napiElementName = OHOS::AppExecFwk::WrapElementName(env_, element);
|
||||
|
||||
@ -1173,7 +1173,7 @@ void JSUIExtensionConnection::HandleOnAbilityConnectDone(const AppExecFwk::Eleme
|
||||
napi_value methodOnConnect = nullptr;
|
||||
napi_get_named_property(env_, obj, "onConnect", &methodOnConnect);
|
||||
if (methodOnConnect == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get onConnect from object.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get onConnect from object");
|
||||
return;
|
||||
}
|
||||
napi_call_function(env_, obj, methodOnConnect, ARGC_TWO, argv, nullptr);
|
||||
@ -1181,7 +1181,7 @@ void JSUIExtensionConnection::HandleOnAbilityConnectDone(const AppExecFwk::Eleme
|
||||
|
||||
void JSUIExtensionConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OnAbilityDisconnectDone, resultCode:%{public}d", resultCode);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "resultCode:%{public}d", resultCode);
|
||||
wptr<JSUIExtensionConnection> connection = this;
|
||||
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback>
|
||||
([connection, element, resultCode](napi_env env, NapiAsyncTask &task, int32_t status) {
|
||||
@ -1201,7 +1201,7 @@ void JSUIExtensionConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementN
|
||||
void JSUIExtensionConnection::HandleOnAbilityDisconnectDone(const AppExecFwk::ElementName &element,
|
||||
int resultCode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "HandleOnAbilityDisconnectDone, resultCode:%{public}d", resultCode);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "resultCode:%{public}d", resultCode);
|
||||
napi_value napiElementName = OHOS::AppExecFwk::WrapElementName(env_, element);
|
||||
napi_value argv[] = {napiElementName};
|
||||
if (jsConnectionObject_ == nullptr) {
|
||||
@ -1241,7 +1241,7 @@ void JSUIExtensionConnection::CallJsFailed(int32_t errorCode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "CallJsFailed enter");
|
||||
if (jsConnectionObject_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "jsConnectionObject_ nullptr.");
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "jsConnectionObject_ nullptr");
|
||||
return;
|
||||
}
|
||||
napi_value obj = jsConnectionObject_->GetNapiValue();
|
||||
|
@ -43,7 +43,7 @@ void UIExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
std::shared_ptr<AbilityHandler> &handler,
|
||||
const sptr<IRemoteObject> &token)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "UIExtension begin init");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
ExtensionBase<UIExtensionContext>::Init(record, application, handler, token);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ int UIExtensionContext::ILLEGAL_REQUEST_CODE(-1);
|
||||
ErrCode UIExtensionContext::StartAbility(const AAFwk::Want &want) const
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Start ability begin, ability:%{public}s.", want.GetElement().GetAbilityName().c_str());
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin, ability:%{public}s", want.GetElement().GetAbilityName().c_str());
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, token_, ILLEGAL_REQUEST_CODE);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "StartAbility is failed %{public}d", err);
|
||||
@ -39,7 +39,7 @@ ErrCode UIExtensionContext::StartAbility(const AAFwk::Want &want) const
|
||||
ErrCode UIExtensionContext::StartAbility(const AAFwk::Want &want, int requestCode) const
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Start ability begin, requestCode:%{public}d.", requestCode);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin, requestCode:%{public}d", requestCode);
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, token_, requestCode);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "StartAbility is failed %{public}d", err);
|
||||
@ -50,7 +50,7 @@ ErrCode UIExtensionContext::StartAbility(const AAFwk::Want &want, int requestCod
|
||||
ErrCode UIExtensionContext::StartAbility(const AAFwk::Want &want, const AAFwk::StartOptions &startOptions) const
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Start ability begin, ability:%{public}s.", want.GetElement().GetAbilityName().c_str());
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin, ability:%{public}s", want.GetElement().GetAbilityName().c_str());
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, startOptions, token_,
|
||||
ILLEGAL_REQUEST_CODE);
|
||||
if (err != ERR_OK) {
|
||||
@ -73,19 +73,19 @@ ErrCode UIExtensionContext::StartUIServiceExtension(const AAFwk::Want& want, int
|
||||
|
||||
ErrCode UIExtensionContext::TerminateSelf()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "TerminateSelf begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->TerminateAbility(token_, -1, nullptr);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "TerminateSelf is failed %{public}d", err);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "TerminateSelf end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "TerminateSelf end");
|
||||
return err;
|
||||
}
|
||||
|
||||
ErrCode UIExtensionContext::ConnectAbility(
|
||||
const AAFwk::Want &want, const sptr<AbilityConnectCallback> &connectCallback) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Connect ability begin, ability:%{public}s.",
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin, ability:%{public}s",
|
||||
want.GetElement().GetAbilityName().c_str());
|
||||
ErrCode ret =
|
||||
ConnectionManager::GetInstance().ConnectAbility(token_, want, connectCallback);
|
||||
@ -96,19 +96,19 @@ ErrCode UIExtensionContext::ConnectAbility(
|
||||
ErrCode UIExtensionContext::DisconnectAbility(
|
||||
const AAFwk::Want &want, const sptr<AbilityConnectCallback> &connectCallback) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "%{public}s begin.", __func__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
ErrCode ret =
|
||||
ConnectionManager::GetInstance().DisconnectAbility(token_, want, connectCallback);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "%{public}s end DisconnectAbility error, ret=%{public}d", __func__, ret);
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "DisconnectAbility error, ret=%{public}d", ret);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "%{public}s end DisconnectAbility", __func__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ErrCode UIExtensionContext::StartAbilityForResult(const AAFwk::Want &want, int requestCode, RuntimeTask &&task)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutexlock_);
|
||||
resultCallbacks_.insert(make_pair(requestCode, std::move(task)));
|
||||
@ -118,13 +118,13 @@ ErrCode UIExtensionContext::StartAbilityForResult(const AAFwk::Want &want, int r
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "ret=%{public}d", err);
|
||||
OnAbilityResultInner(requestCode, err, want);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
return err;
|
||||
}
|
||||
|
||||
void UIExtensionContext::InsertResultCallbackTask(int requestCode, RuntimeTask &&task)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "InsertResultCallbackTask");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutexlock_);
|
||||
resultCallbacks_.insert(make_pair(requestCode, std::move(task)));
|
||||
@ -143,7 +143,7 @@ void UIExtensionContext::RemoveResultCallbackTask(int requestCode)
|
||||
ErrCode UIExtensionContext::StartAbilityForResult(
|
||||
const AAFwk::Want &want, const AAFwk::StartOptions &startOptions, int requestCode, RuntimeTask &&task)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutexlock_);
|
||||
resultCallbacks_.insert(make_pair(requestCode, std::move(task)));
|
||||
@ -153,7 +153,7 @@ ErrCode UIExtensionContext::StartAbilityForResult(
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "ret=%{public}d", err);
|
||||
OnAbilityResultInner(requestCode, err, want);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -166,10 +166,10 @@ ErrCode UIExtensionContext::StartAbilityForResultAsCaller(const AAFwk::Want &wan
|
||||
}
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbilityForResultAsCaller(want, token_, requestCode);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "The result = %{public}d.", err);
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "The result = %{public}d", err);
|
||||
OnAbilityResultInner(requestCode, err, want);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "End");
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -184,16 +184,16 @@ ErrCode UIExtensionContext::StartAbilityForResultAsCaller(
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbilityForResultAsCaller(
|
||||
want, startOptions, token_, requestCode);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "The result = %{public}d.", err);
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "The result = %{public}d", err);
|
||||
OnAbilityResultInner(requestCode, err, want);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "End");
|
||||
return err;
|
||||
}
|
||||
|
||||
ErrCode UIExtensionContext::ReportDrawnCompleted()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->ReportDrawnCompleted(token_);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "ret=%{public}d", err);
|
||||
@ -203,7 +203,7 @@ ErrCode UIExtensionContext::ReportDrawnCompleted()
|
||||
|
||||
void UIExtensionContext::OnAbilityResult(int requestCode, int resultCode, const AAFwk::Want &resultData)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
std::lock_guard<std::mutex> lock(mutexlock_);
|
||||
auto callback = resultCallbacks_.find(requestCode);
|
||||
if (callback != resultCallbacks_.end()) {
|
||||
@ -212,7 +212,7 @@ void UIExtensionContext::OnAbilityResult(int requestCode, int resultCode, const
|
||||
}
|
||||
resultCallbacks_.erase(requestCode);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
AppExecFwk::AbilityType UIExtensionContext::GetAbilityInfoType() const
|
||||
@ -228,7 +228,7 @@ AppExecFwk::AbilityType UIExtensionContext::GetAbilityInfoType() const
|
||||
|
||||
void UIExtensionContext::OnAbilityResultInner(int requestCode, int resultCode, const AAFwk::Want &resultData)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
std::lock_guard<std::mutex> lock(mutexlock_);
|
||||
auto callback = resultCallbacks_.find(requestCode);
|
||||
if (callback != resultCallbacks_.end()) {
|
||||
@ -237,7 +237,7 @@ void UIExtensionContext::OnAbilityResultInner(int requestCode, int resultCode, c
|
||||
}
|
||||
resultCallbacks_.erase(requestCode);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
int UIExtensionContext::GenerateCurRequestCode()
|
||||
@ -267,7 +267,7 @@ Ace::UIContent* UIExtensionContext::GetUIContent()
|
||||
ErrCode UIExtensionContext::OpenAtomicService(AAFwk::Want& want, const AAFwk::StartOptions &options, int requestCode,
|
||||
RuntimeTask &&task)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "OpenAtomicService");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
resultCallbacks_.insert(make_pair(requestCode, std::move(task)));
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->OpenAtomicService(want, options, token_, requestCode);
|
||||
if (err != ERR_OK && err != AAFwk::START_ABILITY_WAITING) {
|
||||
|
@ -56,6 +56,7 @@ namespace {
|
||||
constexpr size_t ARGC_ONE = 1;
|
||||
constexpr size_t ARGC_TWO = 2;
|
||||
}
|
||||
constexpr const char* WANT_PARAMS_HOST_WINDOW_ID_KEY = "ohos.extra.param.key.hostwindowid";
|
||||
|
||||
using namespace OHOS::AppExecFwk;
|
||||
|
||||
@ -276,18 +277,7 @@ void JsUIServiceExtension::OnStart(const AAFwk::Want &want, sptr<AAFwk::SessionI
|
||||
napi_value napiWant = OHOS::AppExecFwk::WrapWant(env, want);
|
||||
napi_value argv[] = {napiWant};
|
||||
CallObjectMethod("onCreate", argv, ARGC_ONE);
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
auto extensionWindowConfig = std::make_shared<Rosen::ExtensionWindowConfig>();
|
||||
OnSceneWillCreated(extensionWindowConfig);
|
||||
auto option = GetWindowOption(want, extensionWindowConfig, sessionInfo);
|
||||
sptr<Rosen::Window> extensionWindow = Rosen::Window::Create(extensionWindowConfig->windowName, option, context);
|
||||
if (extensionWindow != nullptr) {
|
||||
OnSceneDidCreated(extensionWindow);
|
||||
context->SetWindow(extensionWindow);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::UISERVC_EXT, "extensionWindow is nullptr");
|
||||
}
|
||||
#endif
|
||||
|
||||
TAG_LOGD(AAFwkTag::UISERVC_EXT, "ok");
|
||||
}
|
||||
|
||||
@ -326,6 +316,26 @@ void JsUIServiceExtension::OnDisconnect(const AAFwk::Want &want,
|
||||
|
||||
void JsUIServiceExtension::OnCommand(const AAFwk::Want &want, bool restart, int startId)
|
||||
{
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
auto context = GetContext();
|
||||
if (firstRequest_ && context != nullptr) {
|
||||
int32_t hostWindowId = want.GetIntParam(WANT_PARAMS_HOST_WINDOW_ID_KEY, 0);
|
||||
TAG_LOGI(AAFwkTag::UISERVC_EXT, "try create window hostWindowId %{public}d", hostWindowId);
|
||||
auto extensionWindowConfig = std::make_shared<Rosen::ExtensionWindowConfig>();
|
||||
OnSceneWillCreated(extensionWindowConfig);
|
||||
auto option = GetWindowOption(want, extensionWindowConfig, hostWindowId);
|
||||
sptr<Rosen::Window> extensionWindow = Rosen::Window::Create(extensionWindowConfig->windowName, option, context);
|
||||
if (extensionWindow != nullptr) {
|
||||
OnSceneDidCreated(extensionWindow);
|
||||
context->SetWindow(extensionWindow);
|
||||
AbilityWindowConfigTransition(option, extensionWindowConfig);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::UISERVC_EXT, "extensionWindow is nullptr");
|
||||
}
|
||||
firstRequest_ = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
Extension::OnCommand(want, restart, startId);
|
||||
TAG_LOGD(AAFwkTag::UISERVC_EXT, "restart=%{public}s,startId=%{public}d.",
|
||||
restart ? "true" : "false",
|
||||
@ -342,6 +352,32 @@ void JsUIServiceExtension::OnCommand(const AAFwk::Want &want, bool restart, int
|
||||
TAG_LOGD(AAFwkTag::UISERVC_EXT, "ok");
|
||||
}
|
||||
|
||||
void JsUIServiceExtension::AbilityWindowConfigTransition(sptr<Rosen::WindowOption>& option,
|
||||
const std::shared_ptr<Rosen::ExtensionWindowConfig>& extensionWindowConfig)
|
||||
{
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UISERVC_EXT, "context is nullptr");
|
||||
return;
|
||||
}
|
||||
auto token = context->GetToken();
|
||||
if (token == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UISERVC_EXT, "token is null.");
|
||||
return;
|
||||
}
|
||||
AAFwk::WindowConfig windowConfig;
|
||||
if (option != nullptr) {
|
||||
windowConfig.windowType = static_cast<int32_t>(option->GetWindowType());
|
||||
}
|
||||
if (extensionWindowConfig != nullptr) {
|
||||
windowConfig.posx = extensionWindowConfig->windowRect.posX_;
|
||||
windowConfig.posy = extensionWindowConfig->windowRect.posY_;
|
||||
windowConfig.width = extensionWindowConfig->windowRect.width_;
|
||||
windowConfig.height = extensionWindowConfig->windowRect.height_;
|
||||
}
|
||||
AAFwk::AbilityManagerClient::GetInstance()->AbilityWindowConfigTransitionDone(token, windowConfig);
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> JsUIServiceExtension::CallOnConnect(const AAFwk::Want &want)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
|
@ -78,7 +78,7 @@ std::shared_ptr<UIServiceExtensionContext> UIServiceExtension::CreateAndInitCont
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
sptr<Rosen::WindowOption> UIServiceExtension::GetWindowOption(const AAFwk::Want &want,
|
||||
const std::shared_ptr< Rosen::ExtensionWindowConfig>& extensionWindowConfig,
|
||||
const sptr<AAFwk::SessionInfo>& sessionInfo)
|
||||
const int32_t hostWindowId)
|
||||
{
|
||||
auto option = sptr<Rosen::WindowOption>::MakeSptr();
|
||||
if (option == nullptr) {
|
||||
@ -87,7 +87,9 @@ sptr<Rosen::WindowOption> UIServiceExtension::GetWindowOption(const AAFwk::Want
|
||||
}
|
||||
if (extensionWindowConfig->windowAttribute == Rosen::ExtensionWindowAttribute::SUB_WINDOW) {
|
||||
option->SetWindowType(Rosen::WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
|
||||
option->SetParentId(sessionInfo->hostWindowId);
|
||||
if (hostWindowId != 0) {
|
||||
option->SetParentId(hostWindowId);
|
||||
}
|
||||
option->SetExtensionTag(true);
|
||||
option->SetSubWindowTitle(extensionWindowConfig->subWindowOptions.title);
|
||||
option->SetSubWindowDecorEnable(extensionWindowConfig->subWindowOptions.decorEnabled);
|
||||
|
@ -20,8 +20,6 @@
|
||||
#include "js_runtime_utils.h"
|
||||
#include "runner_runtime/js_test_runner.h"
|
||||
|
||||
extern const char _binary_delegator_mgmt_abc_start[];
|
||||
extern const char _binary_delegator_mgmt_abc_end[];
|
||||
namespace OHOS {
|
||||
namespace RunnerRuntime {
|
||||
namespace {
|
||||
|
@ -47,14 +47,10 @@ std::shared_ptr<AbilityStage> AbilityStage::Create(
|
||||
}
|
||||
|
||||
void AbilityStage::OnCreate(const AAFwk::Want &want) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "AbilityStage OnCreate come.");
|
||||
}
|
||||
{}
|
||||
|
||||
void AbilityStage::OnDestroy() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "AbilityStage::OnDestroy come");
|
||||
}
|
||||
{}
|
||||
|
||||
std::shared_ptr<Context> AbilityStage::GetContext() const
|
||||
{
|
||||
@ -72,12 +68,12 @@ void AbilityStage::AddAbility(const sptr<IRemoteObject> &token,
|
||||
const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &abilityRecord)
|
||||
{
|
||||
if (token == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "AbilityStage::AddAbility failed, token is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "token is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
if (abilityRecord == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "AbilityStage::AddAbility failed, abilityRecord is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityRecord is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -87,7 +83,7 @@ void AbilityStage::AddAbility(const sptr<IRemoteObject> &token,
|
||||
void AbilityStage::RemoveAbility(const sptr<IRemoteObject> &token)
|
||||
{
|
||||
if (token == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "AbilityStage::RemoveAbility failed, token is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "token is nullptr");
|
||||
return;
|
||||
}
|
||||
abilityRecords_.erase(token);
|
||||
@ -100,30 +96,23 @@ bool AbilityStage::ContainsAbility() const
|
||||
|
||||
std::string AbilityStage::OnAcceptWant(const AAFwk::Want &want)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "AbilityStage::OnAcceptWant come");
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string AbilityStage::OnNewProcessRequest(const AAFwk::Want &want)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "AbilityStage::OnNewProcessRequest come");
|
||||
return "";
|
||||
}
|
||||
|
||||
void AbilityStage::OnConfigurationUpdated(const AppExecFwk::Configuration& configuration)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
}
|
||||
{}
|
||||
|
||||
void AbilityStage::OnMemoryLevel(int level)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
}
|
||||
{}
|
||||
|
||||
int32_t AbilityStage::RunAutoStartupTask(const std::function<void()> &callback, bool &isAsyncCallback,
|
||||
const std::shared_ptr<Context> &stageContext)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
isAsyncCallback = false;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -54,23 +54,23 @@ napi_value AttachAbilityStageContext(napi_env env, void *value, void *)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "AttachAbilityStageContext");
|
||||
if (env == nullptr || value == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid parameter, env or value is nullptr.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid parameter, env or value is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
auto ptr = reinterpret_cast<std::weak_ptr<AbilityContext> *>(value)->lock();
|
||||
if (ptr == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid context.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid context");
|
||||
return nullptr;
|
||||
}
|
||||
napi_value object = CreateJsAbilityStageContext(env, ptr);
|
||||
auto systemModule = JsRuntime::LoadSystemModuleByEngine(env, "application.AbilityStageContext", &object, 1);
|
||||
if (systemModule == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid systemModule.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid systemModule");
|
||||
return nullptr;
|
||||
}
|
||||
auto contextObj = systemModule->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, contextObj, napi_object)) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "LoadSystemModuleByEngine or ConvertNativeValueTo failed.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "LoadSystemModuleByEngine or ConvertNativeValueTo failed");
|
||||
return nullptr;
|
||||
}
|
||||
napi_coerce_to_native_binding_object(
|
||||
@ -78,7 +78,7 @@ napi_value AttachAbilityStageContext(napi_env env, void *value, void *)
|
||||
auto workContext = new (std::nothrow) std::weak_ptr<AbilityRuntime::Context>(ptr);
|
||||
napi_wrap(env, contextObj, workContext,
|
||||
[](napi_env, void *data, void *) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Finalizer for weak_ptr ability stage context is called");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Finalizer context is called");
|
||||
delete static_cast<std::weak_ptr<AbilityRuntime::Context> *>(data);
|
||||
},
|
||||
nullptr, nullptr);
|
||||
@ -103,7 +103,7 @@ std::shared_ptr<AbilityStage> JsAbilityStage::Create(
|
||||
const std::unique_ptr<Runtime>& runtime, const AppExecFwk::HapModuleInfo& hapModuleInfo)
|
||||
{
|
||||
if (runtime == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid parameter, runtime is nullptr.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "runtime is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
auto& jsRuntime = static_cast<JsRuntime&>(*runtime);
|
||||
@ -144,7 +144,6 @@ JsAbilityStage::JsAbilityStage(JsRuntime& jsRuntime, std::unique_ptr<NativeRefer
|
||||
|
||||
JsAbilityStage::~JsAbilityStage()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
auto context = GetContext();
|
||||
if (context) {
|
||||
context->Unbind();
|
||||
@ -174,7 +173,6 @@ void JsAbilityStage::Init(const std::shared_ptr<Context> &context,
|
||||
|
||||
void JsAbilityStage::OnCreate(const AAFwk::Want &want) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
AbilityStage::OnCreate(want);
|
||||
|
||||
if (!jsAbilityStageObj_) {
|
||||
@ -201,7 +199,6 @@ void JsAbilityStage::OnCreate(const AAFwk::Want &want) const
|
||||
|
||||
auto delegator = AppExecFwk::AbilityDelegatorRegistry::GetAbilityDelegator();
|
||||
if (delegator) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Call PostPerformStageStart");
|
||||
delegator->PostPerformStageStart(CreateStageProperty());
|
||||
}
|
||||
}
|
||||
@ -303,20 +300,19 @@ std::string JsAbilityStage::OnNewProcessRequest(const AAFwk::Want &want)
|
||||
|
||||
void JsAbilityStage::OnConfigurationUpdated(const AppExecFwk::Configuration& configuration)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
AbilityStage::OnConfigurationUpdated(configuration);
|
||||
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
auto env = jsRuntime_.GetNapiEnv();
|
||||
auto application = application_.lock();
|
||||
if (application == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "application is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "application is nullptr");
|
||||
return;
|
||||
}
|
||||
// Notify Ability stage context
|
||||
auto fullConfig = application->GetConfiguration();
|
||||
if (!fullConfig) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "configuration is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "configuration is nullptr");
|
||||
return;
|
||||
}
|
||||
JsAbilityStageContext::ConfigurationUpdated(env, shellContextRef_, fullConfig);
|
||||
@ -358,16 +354,16 @@ int32_t JsAbilityStage::RunAutoStartupTask(const std::function<void()> &callback
|
||||
isAsyncCallback = false;
|
||||
auto context = GetContext();
|
||||
if (!context) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context invalid.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context invalid");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
auto hapModuleInfo = context->GetHapModuleInfo();
|
||||
if (!hapModuleInfo) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "hapModuleInfo invalid.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "hapModuleInfo invalid");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (hapModuleInfo->moduleType != AppExecFwk::ModuleType::ENTRY || hapModuleInfo->appStartup.empty()) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "not entry module or appStartup not exist.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "not entry module or appStartup not exist");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (!shellContextRef_) {
|
||||
@ -380,7 +376,7 @@ int32_t JsAbilityStage::RunAutoStartupTask(const std::function<void()> &callback
|
||||
}
|
||||
std::shared_ptr<StartupManager> startupManager = DelayedSingleton<StartupManager>::GetInstance();
|
||||
if (startupManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed to get startupManager.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed to get startupManager");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
std::shared_ptr<StartupTaskManager> startupTaskManager = nullptr;
|
||||
@ -411,12 +407,12 @@ int32_t JsAbilityStage::RegisterStartupTaskFromProfile(std::vector<JsStartupTask
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
std::vector<std::string> profileInfo;
|
||||
if (!GetProfileInfoFromResourceManager(profileInfo)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appStartup config not exist.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appStartup config not exist");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!AnalyzeProfileInfoAndRegisterStartupTask(profileInfo)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appStartup config not exist.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appStartup config not exist");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@ -428,19 +424,19 @@ bool JsAbilityStage::GetProfileInfoFromResourceManager(std::vector<std::string>
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
auto context = GetContext();
|
||||
if (!context) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is nullptr");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto resMgr = context->GetResourceManager();
|
||||
if (!resMgr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "resMgr is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "resMgr is nullptr");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto hapModuleInfo = context->GetHapModuleInfo();
|
||||
if (!hapModuleInfo) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "hapModuleInfo is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "hapModuleInfo is nullptr");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -448,13 +444,13 @@ bool JsAbilityStage::GetProfileInfoFromResourceManager(std::vector<std::string>
|
||||
bool isCompressed = !hapModuleInfo->hapPath.empty();
|
||||
std::string appStartup = hapModuleInfo->appStartup;
|
||||
if (appStartup.empty()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appStartup invalid.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appStartup invalid");
|
||||
return false;
|
||||
}
|
||||
|
||||
GetResFromResMgr(appStartup, resMgr, isCompressed, profileInfo);
|
||||
if (profileInfo.empty()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appStartup config not exist.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appStartup config not exist");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -462,19 +458,19 @@ bool JsAbilityStage::GetProfileInfoFromResourceManager(std::vector<std::string>
|
||||
|
||||
std::unique_ptr<NativeReference> JsAbilityStage::LoadJsSrcEntry(const std::string &srcEntry)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "call.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "call");
|
||||
if (srcEntry.empty()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "srcEntry invalid.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "srcEntry invalid");
|
||||
return nullptr;
|
||||
}
|
||||
auto context = GetContext();
|
||||
if (!context) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
auto hapModuleInfo = context->GetHapModuleInfo();
|
||||
if (!hapModuleInfo) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "hapModuleInfo is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "hapModuleInfo is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -499,13 +495,13 @@ bool JsAbilityStage::LoadJsStartupConfig(const std::string &srcEntry)
|
||||
{
|
||||
std::unique_ptr<NativeReference> startupConfigEntry = LoadJsSrcEntry(srcEntry);
|
||||
if (startupConfigEntry == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "fail to load config src entry.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "fail to load config src entry");
|
||||
return false;
|
||||
}
|
||||
auto env = jsRuntime_.GetNapiEnv();
|
||||
std::shared_ptr<JsStartupConfig> startupConfig = std::make_shared<JsStartupConfig>(env);
|
||||
if (startupConfig == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "startupConfig is null.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "startupConfig is null");
|
||||
return false;
|
||||
}
|
||||
if (startupConfig->Init(startupConfigEntry) != ERR_OK) {
|
||||
|
@ -29,13 +29,13 @@ void JsAbilityStageContext::ConfigurationUpdated(napi_env env, std::shared_ptr<N
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (!jsContext || !config) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "jsContext or config is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "jsContext or config is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
napi_value object = jsContext->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, object, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "object is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "object is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -45,20 +45,20 @@ void JsAbilityLifecycleCallback::CallJsMethodInnerCommon(const std::string &meth
|
||||
|
||||
for (auto &callback : callbacks) {
|
||||
if (!callback.second) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CallJsMethodInnerCommon, Invalid jsCallback");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid jsCallback");
|
||||
return;
|
||||
}
|
||||
|
||||
auto obj = callback.second->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env_, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CallJsMethodInnerCommon, Failed to get object");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get object");
|
||||
return;
|
||||
}
|
||||
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env_, obj, methodName.data(), &method);
|
||||
if (method == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CallJsMethodInnerCommon, Failed to get %{public}s from object",
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get %{public}s from object",
|
||||
methodName.data());
|
||||
return;
|
||||
}
|
||||
@ -76,7 +76,7 @@ void JsAbilityLifecycleCallback::CallJsMethodInnerCommon(const std::string &meth
|
||||
void JsAbilityLifecycleCallback::CallJsMethod(
|
||||
const std::string &methodName, const std::shared_ptr<NativeReference> &ability)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "CallJsMethod methodName = %{public}s", methodName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "methodName = %{public}s", methodName.c_str());
|
||||
if (!ability) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ability is nullptr");
|
||||
return;
|
||||
@ -89,7 +89,7 @@ void JsAbilityLifecycleCallback::CallJsMethod(
|
||||
void JsAbilityLifecycleCallback::CallWindowStageJsMethod(const std::string &methodName,
|
||||
const std::shared_ptr<NativeReference> &ability, const std::shared_ptr<NativeReference> &windowStage)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "CallWindowStageJsMethod methodName = %{public}s", methodName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "methodName = %{public}s", methodName.c_str());
|
||||
if (!ability || !windowStage) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ability or windowStage is nullptr");
|
||||
return;
|
||||
@ -199,18 +199,18 @@ int32_t JsAbilityLifecycleCallback::Register(napi_value jsCallback, bool isSync)
|
||||
|
||||
bool JsAbilityLifecycleCallback::UnRegister(int32_t callbackId, bool isSync)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "UnRegister called, callbackId : %{public}d", callbackId);
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "callbackId : %{public}d", callbackId);
|
||||
if (isSync) {
|
||||
auto it = callbacksSync_.find(callbackId);
|
||||
if (it == callbacksSync_.end()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "UnRegister callbackId: %{public}d is not in callbacksSync_", callbackId);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "callbackId: %{public}d is not in callbacksSync_", callbackId);
|
||||
return false;
|
||||
}
|
||||
return callbacksSync_.erase(callbackId) == 1;
|
||||
}
|
||||
auto it = callbacks_.find(callbackId);
|
||||
if (it == callbacks_.end()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "UnRegister callbackId: %{public}d is not in callbacks_", callbackId);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "callbackId: %{public}d is not in callbacks_", callbackId);
|
||||
return false;
|
||||
}
|
||||
return callbacks_.erase(callbackId) == 1;
|
||||
|
@ -25,14 +25,13 @@ const size_t AbilityStageContext::CONTEXT_TYPE_ID(std::hash<const char*> {} ("Ab
|
||||
|
||||
AbilityStageContext::AbilityStageContext()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Constructor.");
|
||||
contextImpl_ = std::make_shared<ContextImpl>();
|
||||
}
|
||||
|
||||
void AbilityStageContext::SetParentContext(const std::shared_ptr<Context> &context)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -42,7 +41,7 @@ void AbilityStageContext::SetParentContext(const std::shared_ptr<Context> &conte
|
||||
void AbilityStageContext::InitHapModuleInfo(const std::shared_ptr<AppExecFwk::AbilityInfo> &abilityInfo)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -52,7 +51,7 @@ void AbilityStageContext::InitHapModuleInfo(const std::shared_ptr<AppExecFwk::Ab
|
||||
void AbilityStageContext::InitHapModuleInfo(const AppExecFwk::HapModuleInfo &hapModuleInfo)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -62,7 +61,7 @@ void AbilityStageContext::InitHapModuleInfo(const AppExecFwk::HapModuleInfo &hap
|
||||
std::shared_ptr<AppExecFwk::HapModuleInfo> AbilityStageContext::GetHapModuleInfo() const
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -72,7 +71,7 @@ std::shared_ptr<AppExecFwk::HapModuleInfo> AbilityStageContext::GetHapModuleInfo
|
||||
void AbilityStageContext::SetConfiguration(const std::shared_ptr<AppExecFwk::Configuration> &config)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -82,7 +81,7 @@ void AbilityStageContext::SetConfiguration(const std::shared_ptr<AppExecFwk::Con
|
||||
std::shared_ptr<AppExecFwk::Configuration> AbilityStageContext::GetConfiguration() const
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -92,7 +91,7 @@ std::shared_ptr<AppExecFwk::Configuration> AbilityStageContext::GetConfiguration
|
||||
void AbilityStageContext::SetResourceManager(const std::shared_ptr<Global::Resource::ResourceManager> &resourceManager)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -102,7 +101,7 @@ void AbilityStageContext::SetResourceManager(const std::shared_ptr<Global::Resou
|
||||
std::shared_ptr<Global::Resource::ResourceManager> AbilityStageContext::GetResourceManager() const
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -112,7 +111,7 @@ std::shared_ptr<Global::Resource::ResourceManager> AbilityStageContext::GetResou
|
||||
std::string AbilityStageContext::GetBundleName() const
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -122,7 +121,7 @@ std::string AbilityStageContext::GetBundleName() const
|
||||
std::shared_ptr<AppExecFwk::ApplicationInfo> AbilityStageContext::GetApplicationInfo() const
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -132,7 +131,7 @@ std::shared_ptr<AppExecFwk::ApplicationInfo> AbilityStageContext::GetApplication
|
||||
std::shared_ptr<Context> AbilityStageContext::CreateBundleContext(const std::string &bundleName)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -142,7 +141,7 @@ std::shared_ptr<Context> AbilityStageContext::CreateBundleContext(const std::str
|
||||
std::shared_ptr<Context> AbilityStageContext::CreateModuleContext(const std::string &moduleName)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -153,7 +152,7 @@ std::shared_ptr<Context> AbilityStageContext::CreateModuleContext(const std::str
|
||||
const std::string &moduleName)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -164,7 +163,7 @@ std::shared_ptr<Global::Resource::ResourceManager> AbilityStageContext::CreateMo
|
||||
const std::string &bundleName, const std::string &moduleName)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -175,7 +174,7 @@ int32_t AbilityStageContext::CreateSystemHspModuleResourceManager(const std::str
|
||||
const std::string &moduleName, std::shared_ptr<Global::Resource::ResourceManager> &resourceManager)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@ -185,7 +184,7 @@ int32_t AbilityStageContext::CreateSystemHspModuleResourceManager(const std::str
|
||||
std::string AbilityStageContext::GetBundleCodePath() const
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -195,7 +194,7 @@ std::string AbilityStageContext::GetBundleCodePath() const
|
||||
std::string AbilityStageContext::GetBundleCodeDir()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -205,7 +204,7 @@ std::string AbilityStageContext::GetBundleCodeDir()
|
||||
std::string AbilityStageContext::GetCacheDir()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -215,7 +214,7 @@ std::string AbilityStageContext::GetCacheDir()
|
||||
std::string AbilityStageContext::GetTempDir()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -225,7 +224,7 @@ std::string AbilityStageContext::GetTempDir()
|
||||
std::string AbilityStageContext::GetFilesDir()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -235,7 +234,7 @@ std::string AbilityStageContext::GetFilesDir()
|
||||
std::string AbilityStageContext::GetResourceDir()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -245,7 +244,7 @@ std::string AbilityStageContext::GetResourceDir()
|
||||
std::string AbilityStageContext::GetDatabaseDir()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -255,7 +254,7 @@ std::string AbilityStageContext::GetDatabaseDir()
|
||||
std::string AbilityStageContext::GetPreferencesDir()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -265,7 +264,7 @@ std::string AbilityStageContext::GetPreferencesDir()
|
||||
std::string AbilityStageContext::GetGroupDir(std::string groupId)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -275,7 +274,7 @@ std::string AbilityStageContext::GetGroupDir(std::string groupId)
|
||||
int32_t AbilityStageContext::GetSystemDatabaseDir(const std::string &groupId, bool checkExist, std::string &databaseDir)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@ -286,7 +285,7 @@ int32_t AbilityStageContext::GetSystemPreferencesDir(const std::string &groupId,
|
||||
std::string &preferencesDir)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@ -296,7 +295,7 @@ int32_t AbilityStageContext::GetSystemPreferencesDir(const std::string &groupId,
|
||||
std::string AbilityStageContext::GetDistributedFilesDir()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -306,7 +305,7 @@ std::string AbilityStageContext::GetDistributedFilesDir()
|
||||
std::string AbilityStageContext::GetCloudFileDir()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -316,7 +315,7 @@ std::string AbilityStageContext::GetCloudFileDir()
|
||||
std::string AbilityStageContext::GetBaseDir() const
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -326,7 +325,7 @@ std::string AbilityStageContext::GetBaseDir() const
|
||||
bool AbilityStageContext::IsUpdatingConfigurations()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -336,7 +335,7 @@ bool AbilityStageContext::IsUpdatingConfigurations()
|
||||
bool AbilityStageContext::PrintDrawnCompleted()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -346,7 +345,7 @@ bool AbilityStageContext::PrintDrawnCompleted()
|
||||
sptr<IRemoteObject> AbilityStageContext::GetToken()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -356,7 +355,7 @@ sptr<IRemoteObject> AbilityStageContext::GetToken()
|
||||
void AbilityStageContext::SetToken(const sptr<IRemoteObject> &token)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -366,7 +365,7 @@ void AbilityStageContext::SetToken(const sptr<IRemoteObject> &token)
|
||||
void AbilityStageContext::SwitchArea(int mode)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -376,7 +375,7 @@ void AbilityStageContext::SwitchArea(int mode)
|
||||
int AbilityStageContext::GetArea()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return ContextImpl::EL_DEFAULT;
|
||||
}
|
||||
|
||||
@ -386,7 +385,7 @@ int AbilityStageContext::GetArea()
|
||||
Global::Resource::DeviceType AbilityStageContext::GetDeviceType() const
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid contextImpl");
|
||||
return Global::Resource::DeviceType::DEVICE_PHONE;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "hilog_tag_wrapper.h"
|
||||
#include "hitrace_meter.h"
|
||||
#include "running_process_info.h"
|
||||
#include "exit_reason.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
@ -237,9 +238,9 @@ void ApplicationContext::DispatchOnAbilityContinue(const std::shared_ptr<NativeR
|
||||
|
||||
void ApplicationContext::DispatchOnAbilityWillContinue(const std::shared_ptr<NativeReference> &ability)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Dispatch onAbilityWillContinue.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Dispatch onAbilityWillContinue");
|
||||
if (ability == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Parameters invalid, ability is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ability is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -254,9 +255,9 @@ void ApplicationContext::DispatchOnAbilityWillContinue(const std::shared_ptr<Nat
|
||||
void ApplicationContext::DispatchOnWindowStageWillRestore(const std::shared_ptr<NativeReference> &ability,
|
||||
const std::shared_ptr<NativeReference> &windowStage)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Dispatch onWindowStageWillRestore.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Dispatch onWindowStageWillRestore");
|
||||
if (ability == nullptr || windowStage == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Parameters invalid, ability or windowStage is null.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ability or windowStage is null");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -271,9 +272,9 @@ void ApplicationContext::DispatchOnWindowStageWillRestore(const std::shared_ptr<
|
||||
void ApplicationContext::DispatchOnWindowStageRestore(const std::shared_ptr<NativeReference> &ability,
|
||||
const std::shared_ptr<NativeReference> &windowStage)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Dispatch onWindowStageRestore.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Dispatch onWindowStageRestore");
|
||||
if (ability == nullptr || windowStage == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Parameters invalid, ability or windowStage is null.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ability or windowStage is null");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -287,9 +288,9 @@ void ApplicationContext::DispatchOnWindowStageRestore(const std::shared_ptr<Nati
|
||||
|
||||
void ApplicationContext::DispatchOnAbilityWillSaveState(const std::shared_ptr<NativeReference> &ability)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Dispatch onAbilityWillSaveState.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Dispatch onAbilityWillSaveState");
|
||||
if (ability == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Parameters invalid, ability is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ability is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -305,7 +306,7 @@ void ApplicationContext::DispatchOnAbilitySaveState(const std::shared_ptr<Native
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (ability == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Parameters invalid, ability is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ability is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -566,6 +567,11 @@ std::string ApplicationContext::GetTempDir()
|
||||
return (contextImpl_ != nullptr) ? contextImpl_->GetTempDir() : "";
|
||||
}
|
||||
|
||||
std::string ApplicationContext::GetResourceDir()
|
||||
{
|
||||
return (contextImpl_ != nullptr) ? contextImpl_->GetResourceDir() : "";
|
||||
}
|
||||
|
||||
void ApplicationContext::GetAllTempDir(std::vector<std::string> &tempPaths)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
@ -575,11 +581,6 @@ void ApplicationContext::GetAllTempDir(std::vector<std::string> &tempPaths)
|
||||
contextImpl_->GetAllTempDir(tempPaths);
|
||||
}
|
||||
|
||||
std::string ApplicationContext::GetResourceDir()
|
||||
{
|
||||
return (contextImpl_ != nullptr) ? contextImpl_->GetResourceDir() : "";
|
||||
}
|
||||
|
||||
std::string ApplicationContext::GetFilesDir()
|
||||
{
|
||||
return (contextImpl_ != nullptr) ? contextImpl_->GetFilesDir() : "";
|
||||
@ -639,7 +640,7 @@ int32_t ApplicationContext::RestartApp(const AAFwk::Want& want)
|
||||
{
|
||||
std::string abilityName = want.GetElement().GetAbilityName();
|
||||
if (abilityName == "") {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityName is empty.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityName is empty");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
std::string bundleName = GetBundleName();
|
||||
@ -676,11 +677,29 @@ void ApplicationContext::SwitchArea(int mode)
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationContext::SetConfiguration(const std::shared_ptr<AppExecFwk::Configuration> &config)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is null");
|
||||
return;
|
||||
}
|
||||
contextImpl_->SetConfiguration(config);
|
||||
}
|
||||
|
||||
void ApplicationContext::AppHasDarkRes(bool &darkRes)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is null");
|
||||
return;
|
||||
}
|
||||
contextImpl_->AppHasDarkRes(darkRes);
|
||||
}
|
||||
|
||||
void ApplicationContext::SetColorMode(int32_t colorMode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "colorMode:%{public}d.", colorMode);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "colorMode:%{public}d", colorMode);
|
||||
if (colorMode < -1 || colorMode > 1) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "colorMode is invalid.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "colorMode is invalid");
|
||||
return;
|
||||
}
|
||||
AppExecFwk::Configuration config;
|
||||
@ -694,7 +713,7 @@ void ApplicationContext::SetColorMode(int32_t colorMode)
|
||||
|
||||
void ApplicationContext::SetLanguage(const std::string &language)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "language:%{public}s.", language.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "language:%{public}s", language.c_str());
|
||||
AppExecFwk::Configuration config;
|
||||
config.AddItem(AAFwk::GlobalConfigurationKey::SYSTEM_LANGUAGE, language);
|
||||
config.AddItem(AAFwk::GlobalConfigurationKey::LANGUAGE_IS_SET_BY_APP,
|
||||
@ -706,7 +725,7 @@ void ApplicationContext::SetLanguage(const std::string &language)
|
||||
|
||||
void ApplicationContext::SetFont(const std::string &font)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "font:%{public}s.", font.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "font:%{public}s", font.c_str());
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
// Notify Window
|
||||
AppExecFwk::Configuration config;
|
||||
@ -741,7 +760,7 @@ void ApplicationContext::ClearUpApplicationData()
|
||||
int ApplicationContext::GetArea()
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "AbilityContext::contextImpl is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "contextImpl is nullptr");
|
||||
return ContextImpl::EL_DEFAULT;
|
||||
}
|
||||
return contextImpl_->GetArea();
|
||||
@ -772,28 +791,33 @@ void ApplicationContext::RegisterAppFontObserver(AppConfigUpdateCallback appFont
|
||||
appFontCallback_ = appFontCallback;
|
||||
}
|
||||
|
||||
void ApplicationContext::RegisterProcessSecurityExit(AppProcessExitCallback appProcessExitCallback)
|
||||
{
|
||||
appProcessExitCallback_ = appProcessExitCallback;
|
||||
}
|
||||
|
||||
std::string ApplicationContext::GetAppRunningUniqueId() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "GetAppRunningUniqueId is %{public}s.", appRunningUniqueId_.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "GetAppRunningUniqueId is %{public}s", appRunningUniqueId_.c_str());
|
||||
return appRunningUniqueId_;
|
||||
}
|
||||
|
||||
int32_t ApplicationContext::GetCurrentAppCloneIndex()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "getCurrentAppCloneIndex is %{public}d.", appIndex_);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "getCurrentAppCloneIndex is %{public}d", appIndex_);
|
||||
return appIndex_;
|
||||
}
|
||||
|
||||
int32_t ApplicationContext::GetCurrentAppMode()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "getCurrentMode is %{public}d.", appMode_);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "getCurrentMode is %{public}d", appMode_);
|
||||
return appMode_;
|
||||
}
|
||||
|
||||
|
||||
void ApplicationContext::SetAppRunningUniqueId(const std::string &appRunningUniqueId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "SetAppRunningUniqueId is %{public}s.", appRunningUniqueId.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "SetAppRunningUniqueId is %{public}s", appRunningUniqueId.c_str());
|
||||
appRunningUniqueId_ = appRunningUniqueId;
|
||||
}
|
||||
|
||||
@ -802,20 +826,31 @@ int32_t ApplicationContext::SetSupportedProcessCacheSelf(bool isSupport)
|
||||
if (contextImpl_ != nullptr) {
|
||||
return contextImpl_->SetSupportedProcessCacheSelf(isSupport);
|
||||
}
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "contextImpl_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "contextImpl_ is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
void ApplicationContext::SetCurrentAppCloneIndex(int32_t appIndex)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "setCurrentAppCloneIndex is %{public}d.", appIndex);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "setCurrentAppCloneIndex is %{public}d", appIndex);
|
||||
appIndex_ = appIndex;
|
||||
}
|
||||
|
||||
void ApplicationContext::SetCurrentAppMode(int32_t appMode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "setCurrentAppMode is %{public}d.", appMode);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "setCurrentAppMode is %{public}d", appMode);
|
||||
appMode_ = appMode;
|
||||
}
|
||||
|
||||
void ApplicationContext::ProcessSecurityExit(const AAFwk::ExitReason &exitReason)
|
||||
{
|
||||
if (appProcessExitCallback_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "callback is invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "Proc exit, reason: %{public}s", exitReason.exitMsg.c_str());
|
||||
appProcessExitCallback_(exitReason);
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
@ -94,7 +94,7 @@ void JsApplicationStateChangeCallback::Register(napi_value jsCallback)
|
||||
bool JsApplicationStateChangeCallback::UnRegister(napi_value jsCallback)
|
||||
{
|
||||
if (jsCallback == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "jsCallback is nullptr, delete all callback.");
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "jsCallback is nullptr, delete all callback");
|
||||
callbacks_.clear();
|
||||
return true;
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ int32_t ContextImpl::GetGroupDirWithCheck(const std::string &groupId, bool check
|
||||
}
|
||||
int errCode = GetBundleManager();
|
||||
if (errCode != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d.", errCode);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d", errCode);
|
||||
return errCode;
|
||||
}
|
||||
std::string groupDirGet;
|
||||
@ -268,6 +268,20 @@ std::string ContextImpl::GetTempDir()
|
||||
return dir;
|
||||
}
|
||||
|
||||
std::string ContextImpl::GetResourceDir()
|
||||
{
|
||||
std::shared_ptr<AppExecFwk::HapModuleInfo> hapModuleInfoPtr = GetHapModuleInfo();
|
||||
if (hapModuleInfoPtr == nullptr || hapModuleInfoPtr->moduleName.empty()) {
|
||||
return "";
|
||||
}
|
||||
std::string dir = std::string(LOCAL_CODE_PATH) + CONTEXT_FILE_SEPARATOR +
|
||||
hapModuleInfoPtr->moduleName + CONTEXT_RESOURCE_END;
|
||||
if (OHOS::FileExists(dir)) {
|
||||
return dir;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void ContextImpl::GetAllTempDir(std::vector<std::string> &tempPaths)
|
||||
{
|
||||
// Application temp dir
|
||||
@ -299,20 +313,6 @@ void ContextImpl::GetAllTempDir(std::vector<std::string> &tempPaths)
|
||||
}
|
||||
}
|
||||
|
||||
std::string ContextImpl::GetResourceDir()
|
||||
{
|
||||
std::shared_ptr<AppExecFwk::HapModuleInfo> hapModuleInfoPtr = GetHapModuleInfo();
|
||||
if (hapModuleInfoPtr == nullptr || hapModuleInfoPtr->moduleName.empty()) {
|
||||
return "";
|
||||
}
|
||||
std::string dir = std::string(LOCAL_CODE_PATH) + CONTEXT_FILE_SEPARATOR +
|
||||
hapModuleInfoPtr->moduleName + CONTEXT_RESOURCE_END;
|
||||
if (OHOS::FileExists(dir)) {
|
||||
return dir;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string ContextImpl::GetFilesDir()
|
||||
{
|
||||
std::string dir = GetBaseDir() + CONTEXT_FILES;
|
||||
@ -352,18 +352,18 @@ std::string ContextImpl::GetCloudFileDir()
|
||||
|
||||
void ContextImpl::SwitchArea(int mode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "mode:%{public}d.", mode);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "mode:%{public}d", mode);
|
||||
if (mode < 0 || mode >= (int)(sizeof(CONTEXT_ELS) / sizeof(CONTEXT_ELS[0]))) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextImpl::SwitchArea, mode is invalid.");
|
||||
return;
|
||||
}
|
||||
currArea_ = CONTEXT_ELS[mode];
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "currArea:%{public}s.", currArea_.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "currArea:%{public}s", currArea_.c_str());
|
||||
}
|
||||
|
||||
void ContextImpl::SetMcc(std::string mcc)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "mcc:%{public}s.", mcc.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "mcc:%{public}s", mcc.c_str());
|
||||
if (config_) {
|
||||
config_->AddItem(AAFwk::GlobalConfigurationKey::SYSTEM_MCC, mcc);
|
||||
}
|
||||
@ -371,7 +371,7 @@ void ContextImpl::SetMcc(std::string mcc)
|
||||
|
||||
void ContextImpl::SetMnc(std::string mnc)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "mnc:%{public}s.", mnc.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "mnc:%{public}s", mnc.c_str());
|
||||
if (config_) {
|
||||
config_->AddItem(AAFwk::GlobalConfigurationKey::SYSTEM_MNC, mnc);
|
||||
}
|
||||
@ -385,7 +385,7 @@ std::shared_ptr<Context> ContextImpl::CreateModuleContext(const std::string &mod
|
||||
std::shared_ptr<Context> ContextImpl::CreateModuleContext(const std::string &bundleName, const std::string &moduleName)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
if (bundleName.empty() || moduleName.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -418,7 +418,7 @@ std::shared_ptr<Context> ContextImpl::CreateModuleContext(const std::string &bun
|
||||
return hapModuleInfo.moduleName == moduleName;
|
||||
});
|
||||
if (info == bundleInfo.hapModuleInfos.end()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "moduleName is error.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "moduleName is error");
|
||||
return nullptr;
|
||||
}
|
||||
appContext->InitHapModuleInfo(*info);
|
||||
@ -531,7 +531,7 @@ int32_t ContextImpl::GetBundleInfo(const std::string &bundleName, AppExecFwk::Bu
|
||||
|
||||
int errCode = GetBundleManager();
|
||||
if (errCode != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "errCode: %{public}d.", errCode);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "errCode: %{public}d", errCode);
|
||||
return errCode;
|
||||
}
|
||||
|
||||
@ -570,7 +570,7 @@ void ContextImpl::GetBundleInfo(const std::string &bundleName, AppExecFwk::Bundl
|
||||
if (bundleMgr_ == nullptr) {
|
||||
int errCode = GetBundleManager();
|
||||
if (errCode != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d.", errCode);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d", errCode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -600,7 +600,7 @@ int ContextImpl::GetArea()
|
||||
}
|
||||
}
|
||||
if (mode == -1) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "not find mode.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "not find mode");
|
||||
return EL_DEFAULT;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "end");
|
||||
@ -631,7 +631,7 @@ int ContextImpl::GetCurrentAccountId() const
|
||||
int userId = 0;
|
||||
auto instance = DelayedSingleton<AppExecFwk::OsAccountManagerWrapper>::GetInstance();
|
||||
if (instance == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get OsAccountManager instance.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get OsAccountManager instance");
|
||||
return userId;
|
||||
}
|
||||
instance->GetOsAccountLocalIdFromProcess(userId);
|
||||
@ -644,22 +644,22 @@ int ContextImpl::GetCurrentActiveAccountId() const
|
||||
std::vector<int> accountIds;
|
||||
auto instance = DelayedSingleton<AppExecFwk::OsAccountManagerWrapper>::GetInstance();
|
||||
if (instance == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get OsAccountManager instance.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get OsAccountManager instance");
|
||||
return 0;
|
||||
}
|
||||
ErrCode ret = instance->QueryActiveOsAccountIds(accountIds);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextImpl::GetCurrentActiveAccountId error.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextImpl::GetCurrentActiveAccountId error");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (accountIds.size() == 0) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "no accounts.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "no accounts");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (accountIds.size() > 1) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "no current now.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "no current now");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -669,7 +669,7 @@ int ContextImpl::GetCurrentActiveAccountId() const
|
||||
std::shared_ptr<Context> ContextImpl::CreateBundleContext(const std::string &bundleName)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
if (parentContext_ != nullptr) {
|
||||
return parentContext_->CreateBundleContext(bundleName);
|
||||
}
|
||||
@ -681,7 +681,7 @@ std::shared_ptr<Context> ContextImpl::CreateBundleContext(const std::string &bun
|
||||
|
||||
int errCode = GetBundleManager();
|
||||
if (errCode != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d.", errCode);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d", errCode);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -798,12 +798,12 @@ std::shared_ptr<Global::Resource::ResourceManager> ContextImpl::InitResourceMana
|
||||
} else if (bundleInfo.applicationInfo.bundleType == AppExecFwk::BundleType::SHARED) {
|
||||
loadPath = std::regex_replace(loadPath, hsp_pattern, hsp_sandbox);
|
||||
} else if (bundleInfo.applicationInfo.bundleType == AppExecFwk::BundleType::APP_SERVICE_FWK) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "System hsp path, not need translate.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "System hsp path, not need translate");
|
||||
} else {
|
||||
loadPath = std::regex_replace(loadPath, outer_pattern, LOCAL_BUNDLES);
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "loadPath: %{public}s", loadPath.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "loadPath: %{private}s", loadPath.c_str());
|
||||
GetOverlayPath(resourceManager, bundleInfo.name, hapModuleInfo.moduleName, loadPath, currentBundle);
|
||||
AddPatchResource(resourceManager, loadPath, hapModuleInfo.hqfInfo.hqfFilePath,
|
||||
bundleInfo.applicationInfo.debug);
|
||||
@ -838,7 +838,7 @@ void ContextImpl::GetOverlayPath(std::shared_ptr<Global::Resource::ResourceManag
|
||||
}
|
||||
if (overlayModuleInfos.size() == 0) {
|
||||
if (!resourceManager->AddResource(loadPath.c_str())) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "AddResource fail, moduleResPath: %{public}s", loadPath.c_str());
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "AddResource fail, moduleResPath: %{private}s", loadPath.c_str());
|
||||
}
|
||||
} else {
|
||||
std::vector<std::string> overlayPaths;
|
||||
@ -850,7 +850,7 @@ void ContextImpl::GetOverlayPath(std::shared_ptr<Global::Resource::ResourceManag
|
||||
it.hapPath = std::regex_replace(it.hapPath, std::regex(ABS_CODE_PATH), LOCAL_BUNDLES);
|
||||
}
|
||||
if (it.state == AppExecFwk::OverlayState::OVERLAY_ENABLE) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "hapPath: %{public}s", it.hapPath.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "hapPath: %{private}s", it.hapPath.c_str());
|
||||
overlayPaths.emplace_back(it.hapPath);
|
||||
}
|
||||
}
|
||||
@ -902,7 +902,7 @@ void ContextImpl::UpdateResConfig(std::shared_ptr<Global::Resource::ResourceMana
|
||||
if (load && GetApplicationInfo()->apiTargetVersion % API_VERSION_MOD >= API11) {
|
||||
std::shared_ptr<Global::Resource::ResourceManager> currentResMgr = GetResourceManager();
|
||||
if (currentResMgr != nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "apiVersion: %{public}d, load parent config.",
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "apiVersion: %{public}d, load parent config",
|
||||
GetApplicationInfo()->apiTargetVersion);
|
||||
currentResMgr->GetResConfig(*resConfig);
|
||||
}
|
||||
@ -918,7 +918,7 @@ void ContextImpl::UpdateResConfig(std::shared_ptr<Global::Resource::ResourceMana
|
||||
resConfig->GetLocaleInfo()->getLanguage(), resConfig->GetLocaleInfo()->getScript(),
|
||||
resConfig->GetLocaleInfo()->getCountry());
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextImpl::InitResourceManager language: GetLocaleInfo is null.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "LocaleInfo is null");
|
||||
}
|
||||
#endif
|
||||
resConfig->SetDeviceType(GetDeviceType());
|
||||
@ -928,7 +928,7 @@ void ContextImpl::UpdateResConfig(std::shared_ptr<Global::Resource::ResourceMana
|
||||
resConfig->SetMcc(static_cast<uint32_t>(std::stoi(mcc)));
|
||||
resConfig->SetMnc(static_cast<uint32_t>(std::stoi(mnc)));
|
||||
} catch (...) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "Set mcc,mnc failed mcc:%{public}s mnc:%{public}s.", mcc.c_str(), mnc.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Set mcc,mnc failed mcc:%{public}s mnc:%{public}s", mcc.c_str(), mnc.c_str());
|
||||
}
|
||||
resourceManager->UpdateResConfig(*resConfig);
|
||||
}
|
||||
@ -943,11 +943,11 @@ ErrCode ContextImpl::GetBundleManager()
|
||||
|
||||
bundleMgr_ = DelayedSingleton<AppExecFwk::BundleMgrHelper>::GetInstance();
|
||||
if (bundleMgr_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleMgr_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleMgr_ is nullptr");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Success.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Success");
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@ -962,9 +962,7 @@ void ContextImpl::SetApplicationInfo(const std::shared_ptr<AppExecFwk::Applicati
|
||||
|
||||
void ContextImpl::SetResourceManager(const std::shared_ptr<Global::Resource::ResourceManager> &resourceManager)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Start.");
|
||||
resourceManager_ = resourceManager;
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "End.");
|
||||
}
|
||||
|
||||
std::shared_ptr<Global::Resource::ResourceManager> ContextImpl::GetResourceManager() const
|
||||
@ -1005,7 +1003,7 @@ void ContextImpl::InitHapModuleInfo(const std::shared_ptr<AppExecFwk::AbilityInf
|
||||
}
|
||||
int errCode = GetBundleManager();
|
||||
if (errCode != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d.", errCode);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d", errCode);
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -1070,7 +1068,7 @@ void ContextImpl::CreateDirIfNotExist(const std::string& dirPath, const mode_t&
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ForceCreateDirectory, dir: %{public}s", dirPath.c_str());
|
||||
bool createDir = OHOS::ForceCreateDirectory(dirPath);
|
||||
if (!createDir) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "create dir %{public}s failed, errno is %{public}d.", dirPath.c_str(), errno);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "create dir %{public}s failed, errno is %{public}d", dirPath.c_str(), errno);
|
||||
return;
|
||||
}
|
||||
if (mode != 0) {
|
||||
@ -1084,9 +1082,22 @@ void ContextImpl::SetConfiguration(const std::shared_ptr<AppExecFwk::Configurati
|
||||
config_ = config;
|
||||
}
|
||||
|
||||
void ContextImpl::AppHasDarkRes(bool &darkRes)
|
||||
{
|
||||
std::shared_ptr<Global::Resource::ResourceManager> currentResMgr = GetResourceManager();
|
||||
std::unique_ptr<Global::Resource::ResConfig> resConfig(Global::Resource::CreateResConfig());
|
||||
if (currentResMgr == nullptr || resConfig == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "resMgr or resConfig is null");
|
||||
return;
|
||||
}
|
||||
currentResMgr->GetResConfig(*resConfig);
|
||||
darkRes = resConfig->GetAppDarkRes();
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "darkRes %{public}d", darkRes);
|
||||
}
|
||||
|
||||
void ContextImpl::KillProcessBySelf(const bool clearPageStack)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "killProcessBySelf called clearPageStack is %{public}d.", clearPageStack);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "killProcessBySelf called clearPageStack is %{public}d", clearPageStack);
|
||||
auto appMgrClient = DelayedSingleton<AppExecFwk::AppMgrClient>::GetInstance();
|
||||
appMgrClient->KillApplicationSelf(clearPageStack);
|
||||
}
|
||||
@ -1095,14 +1106,14 @@ int32_t ContextImpl::GetProcessRunningInformation(AppExecFwk::RunningProcessInfo
|
||||
{
|
||||
auto appMgrClient = DelayedSingleton<AppExecFwk::AppMgrClient>::GetInstance();
|
||||
auto result = appMgrClient->GetProcessRunningInformation(info);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "result is %{public}d.", result);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "result is %{public}d", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t ContextImpl::RestartApp(const AAFwk::Want& want)
|
||||
{
|
||||
auto result = OHOS::AAFwk::AbilityManagerClient::GetInstance()->RestartApp(want);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "result is %{public}d.", result);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "result is %{public}d", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1120,14 +1131,14 @@ Global::Resource::DeviceType ContextImpl::GetDeviceType() const
|
||||
auto config = GetConfiguration();
|
||||
if (config != nullptr) {
|
||||
auto deviceType = config->GetItem(AAFwk::GlobalConfigurationKey::DEVICE_TYPE);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "deviceType is %{public}s.", deviceType.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "deviceType is %{public}s", deviceType.c_str());
|
||||
deviceType_ = AppExecFwk::ConvertDeviceType(deviceType);
|
||||
}
|
||||
|
||||
if (deviceType_ == Global::Resource::DeviceType::DEVICE_NOT_SET) {
|
||||
deviceType_ = Global::Resource::DeviceType::DEVICE_PHONE;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "deviceType is %{public}d.", deviceType_);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "deviceType is %{public}d", deviceType_);
|
||||
return deviceType_;
|
||||
}
|
||||
|
||||
@ -1136,7 +1147,7 @@ ErrCode ContextImpl::GetOverlayMgrProxy()
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
int errCode = GetBundleManager();
|
||||
if (errCode != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d.", errCode);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d", errCode);
|
||||
return errCode;
|
||||
}
|
||||
|
||||
@ -1147,7 +1158,7 @@ ErrCode ContextImpl::GetOverlayMgrProxy()
|
||||
|
||||
overlayMgrProxy_ = bundleMgr_->GetOverlayManagerProxy();
|
||||
if (overlayMgrProxy_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetOverlayManagerProxy failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetOverlayManagerProxy failed");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
|
||||
@ -1161,14 +1172,14 @@ int ContextImpl::GetOverlayModuleInfos(const std::string &bundleName, const std:
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
int errCode = GetOverlayMgrProxy();
|
||||
if (errCode != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d.", errCode);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d", errCode);
|
||||
return errCode;
|
||||
}
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, "overlayMgrProxy_->GetTargetOverlayModuleInfo");
|
||||
auto ret = overlayMgrProxy_->GetTargetOverlayModuleInfo(moduleName, overlayModuleInfos);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "GetOverlayModuleInfo form bms failed.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "GetOverlayModuleInfo form bms failed");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -1193,7 +1204,7 @@ std::vector<std::string> ContextImpl::GetAddOverlayPaths(
|
||||
if ((iter != overlayModuleInfos_.end()) && (it.state == AppExecFwk::OverlayState::OVERLAY_ENABLE)) {
|
||||
iter->state = it.state;
|
||||
ChangeToLocalPath(iter->bundleName, iter->hapPath, iter->hapPath);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "add path:%{public}s", iter->hapPath.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "add path:%{private}s", iter->hapPath.c_str());
|
||||
addPaths.emplace_back(iter->hapPath);
|
||||
}
|
||||
}
|
||||
@ -1214,7 +1225,7 @@ std::vector<std::string> ContextImpl::GetRemoveOverlayPaths(
|
||||
if ((iter != overlayModuleInfos_.end()) && (it.state != AppExecFwk::OverlayState::OVERLAY_ENABLE)) {
|
||||
iter->state = it.state;
|
||||
ChangeToLocalPath(iter->bundleName, iter->hapPath, iter->hapPath);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "remove path:%{public}s", iter->hapPath.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "remove path:%{private}s", iter->hapPath.c_str());
|
||||
removePaths.emplace_back(iter->hapPath);
|
||||
}
|
||||
}
|
||||
@ -1227,25 +1238,25 @@ void ContextImpl::OnOverlayChanged(const EventFwk::CommonEventData &data,
|
||||
const std::string &moduleName, const std::string &loadPath)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
auto want = data.GetWant();
|
||||
std::string action = want.GetAction();
|
||||
if (action != OVERLAY_STATE_CHANGED) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Not this subscribe, action: %{public}s.", action.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Not this subscribe, action: %{public}s", action.c_str());
|
||||
return;
|
||||
}
|
||||
if (GetBundleName() != bundleName) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Not this app, bundleName: %{public}s.", bundleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Not this app, bundleName: %{public}s", bundleName.c_str());
|
||||
return;
|
||||
}
|
||||
bool isEnable = data.GetWant().GetBoolParam(AppExecFwk::Constants::OVERLAY_STATE, false);
|
||||
// 1.get overlay hapPath
|
||||
if (resourceManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "resourceManager is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "resourceManager is nullptr");
|
||||
return;
|
||||
}
|
||||
if (overlayModuleInfos_.size() == 0) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "overlayModuleInfos is empty.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "overlayModuleInfos is empty");
|
||||
return;
|
||||
}
|
||||
std::vector<AppExecFwk::OverlayModuleInfo> overlayModuleInfos;
|
||||
@ -1256,7 +1267,7 @@ void ContextImpl::OnOverlayChanged(const EventFwk::CommonEventData &data,
|
||||
|
||||
// 2.add/remove overlay hapPath
|
||||
if (loadPath.empty() || overlayModuleInfos.size() == 0) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "There is not any hapPath in overlayModuleInfo.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "There is not any hapPath in overlayModuleInfo");
|
||||
} else {
|
||||
if (isEnable) {
|
||||
std::vector<std::string> overlayPaths = GetAddOverlayPaths(overlayModuleInfos);
|
||||
|
@ -32,23 +32,23 @@ int32_t JsEnvironmentCallback::serialNumber_ = 0;
|
||||
void JsEnvironmentCallback::CallConfigurationUpdatedInner(const std::string &methodName,
|
||||
const AppExecFwk::Configuration &config, const std::map<int32_t, std::shared_ptr<NativeReference>> &callbacks)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "CallConfigurationUpdatedInner methodName = %{public}s", methodName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "methodName = %{public}s", methodName.c_str());
|
||||
for (auto &callback : callbacks) {
|
||||
if (!callback.second) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CallConfigurationUpdatedInner, Invalid jsCallback");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, " Invalid jsCallback");
|
||||
return;
|
||||
}
|
||||
|
||||
auto obj = callback.second->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env_, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CallConfigurationUpdatedInner, Failed to get object");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get object");
|
||||
return;
|
||||
}
|
||||
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env_, obj, methodName.data(), &method);
|
||||
if (method == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CallConfigurationUpdatedInner, Failed to get %{public}s from object",
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get %{public}s from object",
|
||||
methodName.data());
|
||||
return;
|
||||
}
|
||||
@ -80,23 +80,23 @@ void JsEnvironmentCallback::OnConfigurationUpdated(const AppExecFwk::Configurati
|
||||
void JsEnvironmentCallback::CallMemoryLevelInner(const std::string &methodName, const int level,
|
||||
const std::map<int32_t, std::shared_ptr<NativeReference>> &callbacks)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "CallMemoryLevelInner methodName = %{public}s", methodName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "methodName = %{public}s", methodName.c_str());
|
||||
for (auto &callback : callbacks) {
|
||||
if (!callback.second) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CallMemoryLevelInner, Invalid jsCallback");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid jsCallback");
|
||||
return;
|
||||
}
|
||||
|
||||
auto obj = callback.second->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env_, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CallMemoryLevelInner, Failed to get object");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get object");
|
||||
return;
|
||||
}
|
||||
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env_, obj, methodName.data(), &method);
|
||||
if (method == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CallMemoryLevelInner, Failed to get %{public}s from object", methodName.data());
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get %{public}s from object", methodName.data());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -126,7 +126,6 @@ void JsEnvironmentCallback::OnMemoryLevel(const int level)
|
||||
|
||||
int32_t JsEnvironmentCallback::Register(napi_value jsCallback, bool isSync)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start");
|
||||
if (env_ == nullptr) {
|
||||
return -1;
|
||||
}
|
||||
@ -143,17 +142,16 @@ int32_t JsEnvironmentCallback::Register(napi_value jsCallback, bool isSync)
|
||||
} else {
|
||||
callbacks_.emplace(callbackId, std::shared_ptr<NativeReference>(reinterpret_cast<NativeReference*>(ref)));
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "end");
|
||||
return callbackId;
|
||||
}
|
||||
|
||||
bool JsEnvironmentCallback::UnRegister(int32_t callbackId, bool isSync)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "UnRegister called, env callbackId : %{public}d", callbackId);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "callbackId : %{public}d", callbackId);
|
||||
if (isSync) {
|
||||
auto it = callbacksSync_.find(callbackId);
|
||||
if (it == callbacksSync_.end()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "UnRegister env callbackId: %{public}d is not in callbacksSync_", callbackId);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "callbackId: %{public}d is not in callbacksSync_", callbackId);
|
||||
return false;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "callbacksSync_.callbackId : %{public}d", it->first);
|
||||
@ -161,7 +159,7 @@ bool JsEnvironmentCallback::UnRegister(int32_t callbackId, bool isSync)
|
||||
}
|
||||
auto it = callbacks_.find(callbackId);
|
||||
if (it == callbacks_.end()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "UnRegister env callbackId: %{public}d is not in callbacks_", callbackId);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "callbackId: %{public}d is not in callbacks_", callbackId);
|
||||
return false;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "callbacks_.callbackId : %{public}d", it->first);
|
||||
|
@ -733,12 +733,12 @@ napi_value JsApplicationContextUtils::OnPreloadUIExtensionAbility(napi_env env,
|
||||
NapiAsyncTask::ExecuteCallback execute = [applicationContext = applicationContext_, want, innerErrCode]() {
|
||||
auto context = applicationContext.lock();
|
||||
if (!context) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is released");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "applicationContext is released");
|
||||
*innerErrCode = static_cast<int>(AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT);
|
||||
return;
|
||||
}
|
||||
auto hostBundleName = context->GetBundleName();
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "HostBundleName is %{public}s.", hostBundleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "HostBundleName is %{public}s", hostBundleName.c_str());
|
||||
*innerErrCode = AAFwk::AbilityManagerClient::GetInstance()->PreloadUIExtensionAbility(want, hostBundleName);
|
||||
};
|
||||
NapiAsyncTask::CompleteCallback complete = [innerErrCode](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
@ -894,23 +894,22 @@ napi_value JsApplicationContextUtils::OnRegisterAbilityLifecycleCallback(
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
// only support one params
|
||||
if (info.argc != ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Not enough params.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Not enough params");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
if (callback_ != nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "callback_ is not nullptr.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "callback_ is not nullptr");
|
||||
return CreateJsValue(env, callback_->Register(info.argv[0]));
|
||||
}
|
||||
callback_ = std::make_shared<JsAbilityLifecycleCallback>(env);
|
||||
int32_t callbackId = callback_->Register(info.argv[INDEX_ZERO]);
|
||||
applicationContext->RegisterAbilityLifecycleCallback(callback_);
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "end");
|
||||
return CreateJsValue(env, callbackId);
|
||||
}
|
||||
|
||||
@ -921,7 +920,7 @@ napi_value JsApplicationContextUtils::OnUnregisterAbilityLifecycleCallback(
|
||||
int32_t errCode = 0;
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr");
|
||||
errCode = ERROR_CODE_ONE;
|
||||
}
|
||||
int32_t callbackId = -1;
|
||||
@ -981,34 +980,32 @@ napi_value JsApplicationContextUtils::OnRegisterEnvironmentCallback(
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
// only support one params
|
||||
if (info.argc != ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Not enough params.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Not enough params");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
if (envCallback_ != nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "envCallback_ is not nullptr.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "envCallback_ is not nullptr");
|
||||
return CreateJsValue(env, envCallback_->Register(info.argv[0]));
|
||||
}
|
||||
envCallback_ = std::make_shared<JsEnvironmentCallback>(env);
|
||||
int32_t callbackId = envCallback_->Register(info.argv[INDEX_ZERO]);
|
||||
applicationContext->RegisterEnvironmentCallback(envCallback_);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "end");
|
||||
return CreateJsValue(env, callbackId);
|
||||
}
|
||||
|
||||
napi_value JsApplicationContextUtils::OnUnregisterEnvironmentCallback(
|
||||
napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
int32_t errCode = 0;
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr");
|
||||
errCode = ERROR_CODE_ONE;
|
||||
}
|
||||
int32_t callbackId = -1;
|
||||
@ -1017,7 +1014,7 @@ napi_value JsApplicationContextUtils::OnUnregisterEnvironmentCallback(
|
||||
errCode = ERROR_CODE_ONE;
|
||||
} else {
|
||||
napi_get_value_int32(env, info.argv[INDEX_ZERO], &callbackId);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "callbackId is %{public}d.", callbackId);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "callbackId is %{public}d", callbackId);
|
||||
}
|
||||
std::weak_ptr<JsEnvironmentCallback> envCallbackWeak(envCallback_);
|
||||
NapiAsyncTask::CompleteCallback complete = [envCallbackWeak, callbackId, errCode](
|
||||
@ -1033,9 +1030,8 @@ napi_value JsApplicationContextUtils::OnUnregisterEnvironmentCallback(
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
if (!env_callback->UnRegister(callbackId)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "call UnRegister failed!");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "call UnRegister failed");
|
||||
task.Reject(env, CreateJsError(env, ERROR_CODE_ONE, "call UnRegister failed!"));
|
||||
return;
|
||||
}
|
||||
@ -1064,7 +1060,7 @@ napi_value JsApplicationContextUtils::OnOn(napi_env env, NapiCallbackInfo& info)
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
|
||||
if (info.argc != ARGC_TWO) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Not enough params.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Not enough params");
|
||||
ThrowInvalidParamError(env, "Not enough params.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -1076,7 +1072,7 @@ napi_value JsApplicationContextUtils::OnOn(napi_env env, NapiCallbackInfo& info)
|
||||
}
|
||||
std::string type;
|
||||
if (!ConvertFromJsValue(env, info.argv[0], type)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "convert type failed!");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "convert type failed");
|
||||
ThrowInvalidParamError(env,
|
||||
"Parse param type failed, type must be string.");
|
||||
return CreateJsUndefined(env);
|
||||
@ -1097,7 +1093,7 @@ napi_value JsApplicationContextUtils::OnOn(napi_env env, NapiCallbackInfo& info)
|
||||
if (type == "applicationStateChange") {
|
||||
return OnOnApplicationStateChange(env, info);
|
||||
}
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "on function type not match.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "on function type not match");
|
||||
ThrowInvalidParamError(env, "Parse param callback failed, callback must be function.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -1118,7 +1114,7 @@ napi_value JsApplicationContextUtils::OnOff(napi_env env, NapiCallbackInfo& info
|
||||
}
|
||||
std::string type;
|
||||
if (!ConvertFromJsValue(env, info.argv[0], type)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "convert type failed!");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "convert type failed");
|
||||
ThrowInvalidParamError(env,
|
||||
"Parse param type failed, type must be string.");
|
||||
return CreateJsUndefined(env);
|
||||
@ -1160,34 +1156,29 @@ napi_value JsApplicationContextUtils::OnOff(napi_env env, NapiCallbackInfo& info
|
||||
napi_value JsApplicationContextUtils::OnOnAbilityLifecycle(
|
||||
napi_env env, NapiCallbackInfo& info, bool isSync)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr");
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
if (callback_ != nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "callback_ is not nullptr.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "callback_ is not nullptr");
|
||||
return CreateJsValue(env, callback_->Register(info.argv[1], isSync));
|
||||
}
|
||||
callback_ = std::make_shared<JsAbilityLifecycleCallback>(env);
|
||||
int32_t callbackId = callback_->Register(info.argv[1], isSync);
|
||||
applicationContext->RegisterAbilityLifecycleCallback(callback_);
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "end");
|
||||
return CreateJsValue(env, callbackId);
|
||||
}
|
||||
|
||||
napi_value JsApplicationContextUtils::OnOffAbilityLifecycle(
|
||||
napi_env env, NapiCallbackInfo& info, int32_t callbackId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr");
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -1203,9 +1194,8 @@ napi_value JsApplicationContextUtils::OnOffAbilityLifecycle(
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "OnOffAbilityLifecycle begin");
|
||||
if (!callback->UnRegister(callbackId, false)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "call UnRegister failed!");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "call UnRegister failed");
|
||||
task.Reject(env, CreateJsError(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER,
|
||||
"call UnRegister failed!"));
|
||||
return;
|
||||
@ -1227,7 +1217,7 @@ napi_value JsApplicationContextUtils::OnOffAbilityLifecycleEventSync(
|
||||
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr");
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_EXTERNAL_INTERNAL_ERROR);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -1274,7 +1264,7 @@ napi_value JsApplicationContextUtils::OnOffEnvironment(
|
||||
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr");
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -1293,7 +1283,7 @@ napi_value JsApplicationContextUtils::OnOffEnvironment(
|
||||
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "OnOffEnvironment begin");
|
||||
if (!env_callback->UnRegister(callbackId, false)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "call UnRegister failed!");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "call UnRegister failed");
|
||||
task.Reject(env, CreateJsError(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER,
|
||||
"call UnRegister failed!"));
|
||||
return;
|
||||
@ -1315,7 +1305,7 @@ napi_value JsApplicationContextUtils::OnOffEnvironmentEventSync(
|
||||
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr");
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_EXTERNAL_INTERNAL_ERROR);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -1325,7 +1315,7 @@ napi_value JsApplicationContextUtils::OnOffEnvironmentEventSync(
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
if (!envCallback_->UnRegister(callbackId, true)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "call UnRegister failed!");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "call UnRegister failed");
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_EXTERNAL_INTERNAL_ERROR);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -1338,7 +1328,7 @@ napi_value JsApplicationContextUtils::OnOnApplicationStateChange(
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr");
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -1361,14 +1351,14 @@ napi_value JsApplicationContextUtils::OnOffApplicationStateChange(
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationContext is nullptr");
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(applicationStateCallbackLock_);
|
||||
if (applicationStateCallback_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationStateCallback_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ApplicationStateCallback_ is nullptr");
|
||||
ThrowInvalidParamError(env,
|
||||
"Parse applicationStateCallback failed, applicationStateCallback must be function.");
|
||||
return CreateJsUndefined(env);
|
||||
@ -1377,7 +1367,7 @@ napi_value JsApplicationContextUtils::OnOffApplicationStateChange(
|
||||
if (info.argc == ARGC_ONE || !CheckTypeForNapiValue(env, info.argv[INDEX_ONE], napi_object)) {
|
||||
applicationStateCallback_->UnRegister();
|
||||
} else if (!applicationStateCallback_->UnRegister(info.argv[INDEX_ONE])) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "call UnRegister failed!");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "call UnRegister failed");
|
||||
ThrowInvalidParamError(env, "Parse param call UnRegister failed, call UnRegister must be function.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
@ -107,7 +107,6 @@ napi_value JsBaseContext::GetApplicationContext(napi_env env, napi_callback_info
|
||||
|
||||
napi_value JsBaseContext::SwitchArea(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnSwitchArea, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -151,7 +150,6 @@ napi_value JsBaseContext::OnSwitchArea(napi_env env, NapiCallbackInfo& info)
|
||||
|
||||
napi_value JsBaseContext::CreateModuleContext(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnCreateModuleContext, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -168,7 +166,7 @@ napi_value JsBaseContext::OnCreateModuleContext(napi_env env, NapiCallbackInfo&
|
||||
std::string moduleName;
|
||||
|
||||
if (!ConvertFromJsValue(env, info.argv[1], moduleName)) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Parse inner module name.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Parse inner module name");
|
||||
if (!ConvertFromJsValue(env, info.argv[0], moduleName)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Parse moduleName failed");
|
||||
ThrowInvalidParamError(env, "Parse param moduleName failed, moduleName must be string.");
|
||||
@ -187,12 +185,12 @@ napi_value JsBaseContext::OnCreateModuleContext(napi_env env, NapiCallbackInfo&
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_NOT_SYSTEM_APP);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Parse outer module name.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Parse outer module name");
|
||||
moduleContext = context->CreateModuleContext(bundleName, moduleName);
|
||||
}
|
||||
|
||||
if (!moduleContext) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed to create module context.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed to create module context");
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -204,7 +202,7 @@ napi_value JsBaseContext::CreateJsModuleContext(napi_env env, const std::shared_
|
||||
napi_value value = CreateJsBaseContext(env, moduleContext, true);
|
||||
auto systemModule = JsRuntime::LoadSystemModuleByEngine(env, "application.Context", &value, 1);
|
||||
if (systemModule == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid systemModule.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid systemModule");
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -227,7 +225,6 @@ napi_value JsBaseContext::CreateJsModuleContext(napi_env env, const std::shared_
|
||||
|
||||
napi_value JsBaseContext::CreateSystemHspModuleResourceManager(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext,
|
||||
OnCreateSystemHspModuleResourceManager, BASE_CONTEXT_NAME);
|
||||
}
|
||||
@ -272,7 +269,6 @@ napi_value JsBaseContext::OnCreateSystemHspModuleResourceManager(napi_env env, N
|
||||
|
||||
napi_value JsBaseContext::CreateModuleResourceManager(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnCreateModuleResourceManager, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -314,7 +310,6 @@ napi_value JsBaseContext::OnCreateModuleResourceManager(napi_env env, NapiCallba
|
||||
|
||||
napi_value JsBaseContext::GetArea(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnGetArea, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -331,7 +326,6 @@ napi_value JsBaseContext::OnGetArea(napi_env env, NapiCallbackInfo& info)
|
||||
|
||||
napi_value JsBaseContext::GetCacheDir(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnGetCacheDir, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -348,7 +342,6 @@ napi_value JsBaseContext::OnGetCacheDir(napi_env env, NapiCallbackInfo& info)
|
||||
|
||||
napi_value JsBaseContext::GetTempDir(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnGetTempDir, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -365,7 +358,6 @@ napi_value JsBaseContext::OnGetTempDir(napi_env env, NapiCallbackInfo& info)
|
||||
|
||||
napi_value JsBaseContext::GetResourceDir(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnGetResourceDir, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -382,7 +374,6 @@ napi_value JsBaseContext::OnGetResourceDir(napi_env env, NapiCallbackInfo& info)
|
||||
|
||||
napi_value JsBaseContext::GetFilesDir(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnGetFilesDir, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -399,7 +390,6 @@ napi_value JsBaseContext::OnGetFilesDir(napi_env env, NapiCallbackInfo& info)
|
||||
|
||||
napi_value JsBaseContext::GetDistributedFilesDir(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnGetDistributedFilesDir, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -416,7 +406,6 @@ napi_value JsBaseContext::OnGetDistributedFilesDir(napi_env env, NapiCallbackInf
|
||||
|
||||
napi_value JsBaseContext::GetDatabaseDir(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnGetDatabaseDir, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -433,7 +422,6 @@ napi_value JsBaseContext::OnGetDatabaseDir(napi_env env, NapiCallbackInfo& info)
|
||||
|
||||
napi_value JsBaseContext::GetPreferencesDir(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnGetPreferencesDir, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -450,7 +438,6 @@ napi_value JsBaseContext::OnGetPreferencesDir(napi_env env, NapiCallbackInfo& in
|
||||
|
||||
napi_value JsBaseContext::GetGroupDir(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnGetGroupDir, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -469,7 +456,6 @@ napi_value JsBaseContext::OnGetGroupDir(napi_env env, NapiCallbackInfo& info)
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Get Group Dir");
|
||||
auto complete = [context = context_, groupId]
|
||||
(napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto completeContext = context.lock();
|
||||
@ -491,7 +477,6 @@ napi_value JsBaseContext::OnGetGroupDir(napi_env env, NapiCallbackInfo& info)
|
||||
|
||||
napi_value JsBaseContext::GetBundleCodeDir(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
GET_NAPI_INFO_WITH_NAME_AND_CALL(env, info, JsBaseContext, OnGetBundleCodeDir, BASE_CONTEXT_NAME);
|
||||
}
|
||||
|
||||
@ -564,7 +549,7 @@ napi_value JsBaseContext::CreateJsBundleContext(napi_env env, const std::shared_
|
||||
napi_value value = CreateJsBaseContext(env, bundleContext, true);
|
||||
auto systemModule = JsRuntime::LoadSystemModuleByEngine(env, "application.Context", &value, 1);
|
||||
if (systemModule == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "OnCreateBundleContext, invalid systemModule.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "OnCreateBundleContext, invalid systemModule");
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -587,7 +572,6 @@ napi_value JsBaseContext::CreateJsBundleContext(napi_env env, const std::shared_
|
||||
|
||||
napi_value JsBaseContext::OnGetApplicationContext(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start");
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "context is already released");
|
||||
@ -619,7 +603,7 @@ napi_value JsBaseContext::CreateJSApplicationContext(napi_env env,
|
||||
napi_value value = JsApplicationContextUtils::CreateJsApplicationContext(env);
|
||||
auto systemModule = JsRuntime::LoadSystemModuleByEngine(env, "application.ApplicationContext", &value, 1);
|
||||
if (systemModule == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "OnGetApplicationContext, invalid systemModule.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "OnGetApplicationContext, invalid systemModule");
|
||||
AbilityRuntimeErrorUtil::Throw(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -661,18 +645,18 @@ napi_value AttachBaseContext(napi_env env, void* value, void* hint)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (value == nullptr || env == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid parameter.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid parameter");
|
||||
return nullptr;
|
||||
}
|
||||
auto ptr = reinterpret_cast<std::weak_ptr<Context>*>(value)->lock();
|
||||
if (ptr == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid context.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid context");
|
||||
return nullptr;
|
||||
}
|
||||
napi_value object = CreateJsBaseContext(env, ptr, true);
|
||||
auto systemModule = JsRuntime::LoadSystemModuleByEngine(env, "application.Context", &object, 1);
|
||||
if (systemModule == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "AttachBaseContext, invalid systemModule.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "AttachBaseContext, invalid systemModule");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -696,18 +680,18 @@ napi_value AttachApplicationContext(napi_env env, void* value, void* hint)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (value == nullptr || env == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid parameter.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid parameter");
|
||||
return nullptr;
|
||||
}
|
||||
auto ptr = reinterpret_cast<std::weak_ptr<ApplicationContext>*>(value)->lock();
|
||||
if (ptr == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid context.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid context");
|
||||
return nullptr;
|
||||
}
|
||||
napi_value object = JsApplicationContextUtils::CreateJsApplicationContext(env);
|
||||
auto systemModule = JsRuntime::LoadSystemModuleByEngine(env, "application.ApplicationContext", &object, 1);
|
||||
if (systemModule == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid systemModule.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid systemModule");
|
||||
return nullptr;
|
||||
}
|
||||
auto contextObj = systemModule->GetNapiValue();
|
||||
@ -733,7 +717,7 @@ napi_value CreateJsBaseContext(napi_env env, std::shared_ptr<Context> context, b
|
||||
napi_value object = nullptr;
|
||||
napi_create_object(env, &object);
|
||||
if (object == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid object.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "invalid object");
|
||||
return nullptr;
|
||||
}
|
||||
auto jsContext = std::make_unique<JsBaseContext>(context);
|
||||
|
@ -24,7 +24,7 @@ const size_t ExtensionContext::CONTEXT_TYPE_ID(std::hash<const char*> {} ("Exten
|
||||
void ExtensionContext::SetAbilityInfo(const std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> &abilityInfo)
|
||||
{
|
||||
if (abilityInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ExtensionContext::SetAbilityInfo Info == nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityInfo == nullptr");
|
||||
return;
|
||||
}
|
||||
abilityInfo_ = abilityInfo;
|
||||
|
@ -31,13 +31,13 @@ int FormExtensionContext::UpdateForm(const int64_t formId, const AppExecFwk::For
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Update form, formId: %{public}" PRId64 ".", formId);
|
||||
if (formId <= 0) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "FormId can't be negative or zero.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "FormId can't be negative or zero");
|
||||
return ERR_APPEXECFWK_FORM_INVALID_PARAM;
|
||||
}
|
||||
|
||||
// check fms recover status
|
||||
if (AppExecFwk::FormMgr::GetRecoverStatus() == AppExecFwk::Constants::IN_RECOVERING) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Update failed, form is in recover status, can't do action on it.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Update failed, form is in recover status, can't do action on it");
|
||||
return ERR_APPEXECFWK_FORM_IN_RECOVER;
|
||||
}
|
||||
|
||||
@ -54,11 +54,11 @@ int FormExtensionContext::UpdateForm(const int64_t formId, const AppExecFwk::For
|
||||
|
||||
ErrCode FormExtensionContext::StartAbility(const AAFwk::Want &want) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Start ability.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Start ability");
|
||||
// route to FMS
|
||||
ErrCode err = AppExecFwk::FormMgr::GetInstance().StartAbility(want, token_);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Start ability failed with %{public}d.", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Start ability failed with %{public}d", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
@ -30,10 +30,10 @@ int32_t ServiceExtensionContext::ILLEGAL_REQUEST_CODE(-1);
|
||||
ErrCode ServiceExtensionContext::StartAbility(const AAFwk::Want &want) const
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Start ability begin, ability:%{public}s.", want.GetElement().GetAbilityName().c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ability:%{public}s", want.GetElement().GetAbilityName().c_str());
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, token_, ILLEGAL_REQUEST_CODE);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceContext::StartAbility is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "StartAbility is failed %{public}d", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@ -41,11 +41,11 @@ ErrCode ServiceExtensionContext::StartAbility(const AAFwk::Want &want) const
|
||||
ErrCode ServiceExtensionContext::StartAbility(const AAFwk::Want &want, const AAFwk::StartOptions &startOptions) const
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Start ability begin, ability:%{public}s.", want.GetElement().GetAbilityName().c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ability:%{public}s", want.GetElement().GetAbilityName().c_str());
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, startOptions, token_,
|
||||
ILLEGAL_REQUEST_CODE);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceContext::StartAbility is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "StartAbility is failed %{public}d", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@ -53,12 +53,12 @@ ErrCode ServiceExtensionContext::StartAbility(const AAFwk::Want &want, const AAF
|
||||
ErrCode ServiceExtensionContext::StartAbilityAsCaller(const AAFwk::Want &want) const
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Start ability as caller begin, ability:%{public}s.",
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ability:%{public}s",
|
||||
want.GetElement().GetAbilityName().c_str());
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->
|
||||
StartAbilityAsCaller(want, token_, nullptr, ILLEGAL_REQUEST_CODE);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceContext::StartAbilityAsCaller is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "StartAbilityAsCaller is failed %{public}d", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@ -67,12 +67,12 @@ ErrCode ServiceExtensionContext::StartAbilityAsCaller(const AAFwk::Want &want,
|
||||
const AAFwk::StartOptions &startOptions) const
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Start ability as caller begin, ability:%{public}s.",
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ability:%{public}s.",
|
||||
want.GetElement().GetAbilityName().c_str());
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbilityAsCaller(want, startOptions, token_, nullptr,
|
||||
ILLEGAL_REQUEST_CODE);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceContext::StartAbilityAsCaller is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "StartAbilityAsCaller is failed %{public}d", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@ -80,11 +80,11 @@ ErrCode ServiceExtensionContext::StartAbilityAsCaller(const AAFwk::Want &want,
|
||||
ErrCode ServiceExtensionContext::StartAbilityByCall(
|
||||
const AAFwk::Want& want, const std::shared_ptr<CallerCallBack> &callback, int32_t accountId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "%{public}s begin.", __func__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
if (localCallContainer_ == nullptr) {
|
||||
localCallContainer_ = std::make_shared<LocalCallContainer>();
|
||||
if (localCallContainer_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "%{public}s failed, localCallContainer_ is nullptr.", __func__);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "localCallContainer_ == nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
}
|
||||
@ -93,9 +93,9 @@ ErrCode ServiceExtensionContext::StartAbilityByCall(
|
||||
|
||||
ErrCode ServiceExtensionContext::ReleaseCall(const std::shared_ptr<CallerCallBack> &callback) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "%{public}s begin.", __func__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
if (localCallContainer_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "%{public}s failed, localCallContainer_ is nullptr.", __func__);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "localCallContainer_ == nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return localCallContainer_->ReleaseCall(callback);
|
||||
@ -103,9 +103,9 @@ ErrCode ServiceExtensionContext::ReleaseCall(const std::shared_ptr<CallerCallBac
|
||||
|
||||
void ServiceExtensionContext::ClearFailedCallConnection(const std::shared_ptr<CallerCallBack> &callback) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "%{public}s begin.", __func__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
if (localCallContainer_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "%{public}s failed, localCallContainer_ is nullptr.", __func__);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "localCallContainer_ == nullptr");
|
||||
return;
|
||||
}
|
||||
localCallContainer_->ClearFailedCallConnection(callback);
|
||||
@ -114,11 +114,11 @@ void ServiceExtensionContext::ClearFailedCallConnection(const std::shared_ptr<Ca
|
||||
ErrCode ServiceExtensionContext::ConnectAbility(
|
||||
const AAFwk::Want &want, const sptr<AbilityConnectCallback> &connectCallback) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Connect ability begin, ability:%{public}s.",
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ability:%{public}s.",
|
||||
want.GetElement().GetAbilityName().c_str());
|
||||
ErrCode ret =
|
||||
ConnectionManager::GetInstance().ConnectAbility(token_, want, connectCallback);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ServiceExtensionContext::ConnectAbility ErrorCode = %{public}d", ret);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ConnectAbility ErrorCode = %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -136,9 +136,9 @@ ErrCode ServiceExtensionContext::StartAbilityWithAccount(const AAFwk::Want &want
|
||||
}
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(
|
||||
want, token_, ILLEGAL_REQUEST_CODE, accountId);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "%{public}s. End calling StartAbilityWithAccount. ret=%{public}d", __func__, err);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ret=%{public}d", err);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceContext::StartAbilityWithAccount is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "StartAbilityWithAccount is failed %{public}d", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@ -146,46 +146,46 @@ ErrCode ServiceExtensionContext::StartAbilityWithAccount(const AAFwk::Want &want
|
||||
ErrCode ServiceExtensionContext::StartAbilityWithAccount(
|
||||
const AAFwk::Want &want, int32_t accountId, const AAFwk::StartOptions &startOptions) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "%{public}s begin.", __func__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
(const_cast<Want &>(want)).SetParam(START_ABILITY_TYPE, true);
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, startOptions, token_,
|
||||
ILLEGAL_REQUEST_CODE, accountId);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "%{public}s. End calling StartAbilityWithAccount. ret=%{public}d", __func__, err);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "End calling StartAbilityWithAccount. ret=%{public}d", err);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceContext::StartAbilityWithAccount is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "StartAbilityWithAccount is failed %{public}d", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
ErrCode ServiceExtensionContext::StartServiceExtensionAbility(const AAFwk::Want &want, int32_t accountId) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "%{public}s begin.", __func__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartExtensionAbility(
|
||||
want, token_, accountId, AppExecFwk::ExtensionAbilityType::SERVICE);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceContext::StartServiceExtensionAbility is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "StartServiceExtensionAbility is failed %{public}d", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
ErrCode ServiceExtensionContext::StartUIServiceExtensionAbility(const AAFwk::Want &want, int32_t accountId) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartExtensionAbility(
|
||||
want, token_, accountId, AppExecFwk::ExtensionAbilityType::UI_SERVICE);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceContext::StartServiceExtensionAbility is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "StartServiceExtensionAbility is failed %{public}d", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
ErrCode ServiceExtensionContext::StopServiceExtensionAbility(const AAFwk::Want& want, int32_t accountId) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "%{public}s begin.", __func__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StopExtensionAbility(
|
||||
want, token_, accountId, AppExecFwk::ExtensionAbilityType::SERVICE);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceContext::StopServiceExtensionAbility is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "StopServiceExtensionAbility is failed %{public}d", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@ -193,45 +193,42 @@ ErrCode ServiceExtensionContext::StopServiceExtensionAbility(const AAFwk::Want&
|
||||
ErrCode ServiceExtensionContext::ConnectAbilityWithAccount(
|
||||
const AAFwk::Want &want, int32_t accountId, const sptr<AbilityConnectCallback> &connectCallback) const
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "%{public}s begin.", __func__);
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "begin");
|
||||
ErrCode ret =
|
||||
ConnectionManager::GetInstance().ConnectAbilityWithAccount(token_, want, accountId, connectCallback);
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "ServiceExtensionContext::ConnectAbilityWithAccount ErrorCode = %{public}d", ret);
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "ConnectAbilityWithAccount ErrorCode = %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ErrCode ServiceExtensionContext::DisconnectAbility(const AAFwk::Want &want,
|
||||
const sptr<AbilityConnectCallback> &connectCallback, int32_t accountId) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
ErrCode ret =
|
||||
ConnectionManager::GetInstance().DisconnectAbility(token_, want, connectCallback, accountId);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "%{public}s end DisconnectAbility error, ret=%{public}d", __func__, ret);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "DisconnectAbility error, ret=%{public}d", ret);
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "end");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ErrCode ServiceExtensionContext::TerminateAbility()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "%{public}s begin.", __func__);
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "begin");
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->TerminateAbility(token_, -1, nullptr);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceExtensionContext::TerminateAbility is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "TerminateAbility is failed %{public}d", err);
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "%{public}s end.", __func__);
|
||||
return err;
|
||||
}
|
||||
|
||||
ErrCode ServiceExtensionContext::RequestModalUIExtension(const Want &want)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "%{public}s begin.", __func__);
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "begin");
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->RequestModalUIExtension(want);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceExtensionContext::RequestModalUIExtension is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "RequestModalUIExtension is failed %{public}d", err);
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "%{public}s end.", __func__);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -239,26 +236,13 @@ AppExecFwk::AbilityType ServiceExtensionContext::GetAbilityInfoType() const
|
||||
{
|
||||
std::shared_ptr<AppExecFwk::AbilityInfo> info = GetAbilityInfo();
|
||||
if (info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceContext::GetAbilityInfoType info == nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "info == nullptr");
|
||||
return AppExecFwk::AbilityType::UNKNOWN;
|
||||
}
|
||||
|
||||
return info->type;
|
||||
}
|
||||
|
||||
ErrCode ServiceExtensionContext::PreStartMission(const std::string& bundleName, const std::string& moduleName,
|
||||
const std::string& abilityName, const std::string& startTime)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "called");
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->PreStartMission(
|
||||
bundleName, moduleName, abilityName, startTime);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ServiceExtensionContext::PreStartMission is failed %{public}d", err);
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "End.");
|
||||
return err;
|
||||
}
|
||||
|
||||
ErrCode ServiceExtensionContext::AddFreeInstallObserver(const sptr<AbilityRuntime::IFreeInstallObserver> &observer)
|
||||
{
|
||||
ErrCode ret = AAFwk::AbilityManagerClient::GetInstance()->AddFreeInstallObserver(token_, observer);
|
||||
@ -267,5 +251,16 @@ ErrCode ServiceExtensionContext::AddFreeInstallObserver(const sptr<AbilityRuntim
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
ErrCode ServiceExtensionContext::PreStartMission(const std::string& bundleName, const std::string& moduleName,
|
||||
const std::string& abilityName, const std::string& startTime)
|
||||
{
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->PreStartMission(
|
||||
bundleName, moduleName, abilityName, startTime);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "PreStartMission is failed %{public}d", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
@ -36,23 +36,21 @@ int32_t UIServiceExtensionContext::ILLEGAL_REQUEST_CODE(-1);
|
||||
ErrCode UIServiceExtensionContext::StartAbility(const AAFwk::Want &want, const AAFwk::StartOptions &startOptions) const
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Start ability begin, ability:%{public}s.", want.GetElement().GetAbilityName().c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ability:%{public}s", want.GetElement().GetAbilityName().c_str());
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, startOptions, token_,
|
||||
ILLEGAL_REQUEST_CODE);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "UIServiceExtensionContext::StartAbility is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "StartAbility is failed %{public}d", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
ErrCode UIServiceExtensionContext::TerminateSelf()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "begin.");
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->TerminateAbility(token_, -1, nullptr);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "UIServiceExtensionContext::TerminateAbility is failed %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "TerminateAbility is failed %{public}d", err);
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "%{public}s end.", __func__);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -68,7 +66,7 @@ sptr<Rosen::Window> UIServiceExtensionContext::GetWindow()
|
||||
|
||||
Ace::UIContent* UIServiceExtensionContext::GetUIContent()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "called");
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
if (window_ == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "window_ is nullptr");
|
||||
return nullptr;
|
||||
@ -81,12 +79,12 @@ ErrCode UIServiceExtensionContext::StartAbilityByType(const std::string &type,
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "StartAbilityByType begin.");
|
||||
if (uiExtensionCallbacks == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "uiExtensionCallbacks is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "uiExtensionCallbacks is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
auto uiContent = GetUIContent();
|
||||
if (uiContent == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "uiContent is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "uiContent is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
wantParam.SetParam(UIEXTENSION_TARGET_TYPE_KEY, AAFwk::String::Box(type));
|
||||
@ -112,7 +110,7 @@ ErrCode UIServiceExtensionContext::StartAbilityByType(const std::string &type,
|
||||
|
||||
int32_t sessionId = uiContent->CreateModalUIExtension(want, callback, config);
|
||||
if (sessionId == 0) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "CreateModalUIExtension is failed");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CreateModalUIExtension is failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
uiExtensionCallbacks->SetUIContent(uiContent);
|
||||
|
@ -48,13 +48,13 @@ static const int RESULT_ERR = -1;
|
||||
void ApplicationCleaner::RenameTempData()
|
||||
{
|
||||
if (context_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Context is null.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Context is null");
|
||||
return;
|
||||
}
|
||||
std::vector<std::string> tempdir{};
|
||||
context_->GetAllTempDir(tempdir);
|
||||
if (tempdir.empty()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get app temp path list is empty.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get app temp path list is empty");
|
||||
return;
|
||||
}
|
||||
int64_t now =
|
||||
@ -83,12 +83,12 @@ void ApplicationCleaner::ClearTempData()
|
||||
std::vector<std::string> temps;
|
||||
|
||||
if (self->GetRootPath(rootDir) != RESULT_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get root dir error.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get root dir error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->GetObsoleteBundleTempPath(rootDir, temps) != RESULT_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get bundle temp file list is false.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get bundle temp file list is false");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ int ApplicationCleaner::GetRootPath(std::vector<std::string> &rootPath)
|
||||
|
||||
auto instance = DelayedSingleton<AppExecFwk::OsAccountManagerWrapper>::GetInstance();
|
||||
if (instance == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get OsAccountManager instance.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get OsAccountManager instance");
|
||||
return RESULT_ERR;
|
||||
}
|
||||
|
||||
|
@ -32,13 +32,11 @@ ApplicationDataManager &ApplicationDataManager::GetInstance()
|
||||
|
||||
void ApplicationDataManager::AddErrorObserver(const std::shared_ptr<IErrorObserver> &observer)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Add error observer come.");
|
||||
errorObserver_ = observer;
|
||||
}
|
||||
|
||||
bool ApplicationDataManager::NotifyUnhandledException(const std::string &errMsg)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Notify error observer come.");
|
||||
if (errorObserver_) {
|
||||
errorObserver_->OnUnhandledException(errMsg);
|
||||
return true;
|
||||
@ -51,7 +49,6 @@ bool ApplicationDataManager::NotifyUnhandledException(const std::string &errMsg)
|
||||
|
||||
bool ApplicationDataManager::NotifyCJUnhandledException(const std::string &errMsg)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Notify error observer come.");
|
||||
if (errorObserver_) {
|
||||
errorObserver_->OnUnhandledException(errMsg);
|
||||
return true;
|
||||
@ -64,13 +61,11 @@ bool ApplicationDataManager::NotifyCJUnhandledException(const std::string &errMs
|
||||
|
||||
void ApplicationDataManager::RemoveErrorObserver()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Remove error observer come.");
|
||||
errorObserver_ = nullptr;
|
||||
}
|
||||
|
||||
bool ApplicationDataManager::NotifyExceptionObject(const AppExecFwk::ErrorObject &errorObj)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Notify Exception error observer come.");
|
||||
if (errorObserver_) {
|
||||
errorObserver_->OnExceptionObject(errorObj);
|
||||
return true;
|
||||
@ -83,7 +78,7 @@ bool ApplicationDataManager::NotifyExceptionObject(const AppExecFwk::ErrorObject
|
||||
|
||||
bool ApplicationDataManager::NotifyCJExceptionObject(const AppExecFwk::ErrorObject &errorObj)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Notify Exception error observer come.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Notify Exception error observer come");
|
||||
if (errorObserver_) {
|
||||
errorObserver_->OnExceptionObject(errorObj);
|
||||
return true;
|
||||
|
@ -117,7 +117,6 @@ bool ApplicationImpl::PerformTerminate(bool isLastProcess)
|
||||
curState_ = APP_STATE_TERMINATED;
|
||||
return true;
|
||||
}
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "curState is %{public}d", curState_);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ int32_t AssertFaultCallback::OnRemoteRequest(
|
||||
std::u16string descriptor = AssertFaultCallback::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Local descriptor is not equal to remote.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Local descriptor is not equal to remote");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
@ -40,17 +40,17 @@ int32_t AssertFaultCallback::OnRemoteRequest(
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "Unexpected event ID, for default handling.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "Unexpected event ID, for default handling");
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
void AssertFaultCallback::NotifyDebugAssertResult(AAFwk::UserStatus status)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Notify user action result to assert fault thread.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Notify user action result to assert fault thread");
|
||||
status_ = status;
|
||||
auto assertThread = assertFaultThread_.lock();
|
||||
if (assertThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to obtain assert fault thread.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to obtain assert fault thread");
|
||||
return;
|
||||
}
|
||||
assertThread->NotifyReleaseLongWaiting();
|
||||
|
@ -41,7 +41,7 @@ constexpr char ASSERT_FAULT_PROMPT[] = "\n\n(Press Retry to debug the applicatio
|
||||
AAFwk::UserStatus AssertFaultTaskThread::RequestAssertResult(const std::string &exprStr)
|
||||
{
|
||||
if (assertHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Assert handler is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Assert handler is nullptr");
|
||||
return ASSERT_FAULT_DEFAULT_VALUE;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ AAFwk::UserStatus AssertFaultTaskThread::RequestAssertResult(const std::string &
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
auto assertFaultTask = weak.lock();
|
||||
if (assertFaultTask == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Assert fault task instance is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Assert fault task instance is nullptr");
|
||||
return;
|
||||
}
|
||||
assertResult = assertFaultTask->HandleAssertCallback(exprStr);
|
||||
@ -63,7 +63,7 @@ Assert_Status ConvertAssertResult(AAFwk::UserStatus status)
|
||||
{
|
||||
auto result = assertResultMap.find(status);
|
||||
if (result == assertResultMap.end()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Find %{public}d failed, convert assert reuslt error.", status);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Find %{public}d failed, convert assert reuslt error", status);
|
||||
return Assert_Status::ASSERT_ABORT;
|
||||
}
|
||||
return result->second;
|
||||
@ -74,7 +74,7 @@ static Assert_Status AssertCallback(AssertFailureInfo assertFail)
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
auto instance = DelayedSingleton<AbilityRuntime::AssertFaultTaskThread>::GetInstance();
|
||||
if (instance == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid Instance.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid Instance");
|
||||
return Assert_Status::ASSERT_ABORT;
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ static Assert_Status AssertCallback(AssertFailureInfo assertFail)
|
||||
std::string textDetail = textFile + textFunc + textLine + textExpression + ASSERT_FAULT_PROMPT;
|
||||
|
||||
auto ret = ConvertAssertResult(instance->RequestAssertResult(textDetail));
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Return sync task result is %{public}d.", static_cast<int32_t>(ret));
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Return sync task result is %{public}d", static_cast<int32_t>(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -96,13 +96,13 @@ void AssertFaultTaskThread::InitAssertFaultTask(const wptr<AppExecFwk::MainThrea
|
||||
{
|
||||
auto runner = AppExecFwk::EventRunner::Create(ASSERT_FAULT_THREAD);
|
||||
if (runner == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Runner is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Runner is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
auto assertHandler = std::make_shared<AppExecFwk::EventHandler>(runner);
|
||||
if (assertHandler == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Handler is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Handler is nullptr");
|
||||
runner->Stop();
|
||||
return;
|
||||
}
|
||||
@ -117,7 +117,7 @@ void AssertFaultTaskThread::InitAssertFaultTask(const wptr<AppExecFwk::MainThrea
|
||||
void AssertFaultTaskThread::Stop()
|
||||
{
|
||||
if (assertRunner_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Assert runner is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Assert runner is nullptr");
|
||||
return;
|
||||
}
|
||||
assertRunner_->Stop();
|
||||
@ -128,7 +128,7 @@ AAFwk::UserStatus AssertFaultTaskThread::HandleAssertCallback(const std::string
|
||||
{
|
||||
auto mainThread = mainThread_.promote();
|
||||
if (mainThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid thread object.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid thread object");
|
||||
return ASSERT_FAULT_DEFAULT_VALUE;
|
||||
}
|
||||
|
||||
@ -140,13 +140,13 @@ AAFwk::UserStatus AssertFaultTaskThread::HandleAssertCallback(const std::string
|
||||
sptr<AssertFaultCallback> assertFaultCallback =
|
||||
new (std::nothrow) AssertFaultCallback(shared_from_this());
|
||||
if (assertFaultCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid assert fault callback object.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid assert fault callback object");
|
||||
break;
|
||||
}
|
||||
|
||||
auto amsClient = AAFwk::AbilityManagerClient::GetInstance();
|
||||
if (amsClient == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid client object.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Invalid client object");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -155,12 +155,11 @@ AAFwk::UserStatus AssertFaultTaskThread::HandleAssertCallback(const std::string
|
||||
wantParams.SetParam(ASSERT_FAULT_DETAIL, AAFwk::String::Box(exprStr));
|
||||
auto err = amsClient->RequestAssertFaultDialog(assertFaultCallback->AsObject(), wantParams);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Request assert fault dialog failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Request assert fault dialog failed");
|
||||
break;
|
||||
}
|
||||
|
||||
assertResultCV_.wait(lockAssertResult);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Wait assert result over.");
|
||||
assertResult = assertFaultCallback->GetAssertResult();
|
||||
} while (false);
|
||||
|
||||
@ -174,7 +173,6 @@ void AssertFaultTaskThread::NotifyReleaseLongWaiting()
|
||||
{
|
||||
std::unique_lock<std::mutex> lockAssertResult(assertResultMutex_);
|
||||
assertResultCV_.notify_one();
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Notify assert result done.");
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
@ -30,7 +30,6 @@ using OHOS::AbilityRuntime::ChildProcessManager;
|
||||
ChildMainThread::ChildMainThread()
|
||||
{
|
||||
processArgs_ = std::make_shared<ChildProcessArgs>();
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ChildMainThread constructor called");
|
||||
}
|
||||
|
||||
ChildMainThread::~ChildMainThread()
|
||||
@ -40,31 +39,31 @@ ChildMainThread::~ChildMainThread()
|
||||
|
||||
void ChildMainThread::Start(const std::map<std::string, int32_t> &fds)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "ChildMainThread start.");
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "ChildMainThread start");
|
||||
ChildProcessInfo processInfo;
|
||||
auto ret = GetChildProcessInfo(processInfo);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetChildProcessInfo failed, ret:%{public}d.", ret);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetChildProcessInfo failed, ret:%{public}d", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
sptr<ChildMainThread> thread = sptr<ChildMainThread>(new (std::nothrow) ChildMainThread());
|
||||
if (thread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "New ChildMainThread failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "New ChildMainThread failed");
|
||||
return;
|
||||
}
|
||||
thread->SetFds(fds);
|
||||
std::shared_ptr<EventRunner> runner = EventRunner::GetMainEventRunner();
|
||||
if (runner == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runner is null.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runner is null");
|
||||
return;
|
||||
}
|
||||
if (!thread->Init(runner, processInfo)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ChildMainThread Init failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ChildMainThread Init failed");
|
||||
return;
|
||||
}
|
||||
if (!thread->Attach()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ChildMainThread Attach failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ChildMainThread Attach failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -73,7 +72,7 @@ void ChildMainThread::Start(const std::map<std::string, int32_t> &fds)
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ChildMainThread runner->Run failed ret = %{public}d", ret);
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ChildMainThread end.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ChildMainThread end");
|
||||
}
|
||||
|
||||
int32_t ChildMainThread::GetChildProcessInfo(ChildProcessInfo &info)
|
||||
@ -95,7 +94,7 @@ int32_t ChildMainThread::GetChildProcessInfo(ChildProcessInfo &info)
|
||||
void ChildMainThread::SetFds(const std::map<std::string, int32_t> &fds)
|
||||
{
|
||||
if (!processArgs_) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "processArgs_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "processArgs_ is nullptr");
|
||||
return;
|
||||
}
|
||||
processArgs_->fds = fds;
|
||||
@ -105,7 +104,7 @@ bool ChildMainThread::Init(const std::shared_ptr<EventRunner> &runner, const Chi
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (runner == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runner is null.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runner is null");
|
||||
return false;
|
||||
}
|
||||
processInfo_ = std::make_shared<ChildProcessInfo>(processInfo);
|
||||
@ -125,12 +124,12 @@ bool ChildMainThread::Attach()
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
auto sysMrgClient = DelayedSingleton<AppExecFwk::SysMrgClient>::GetInstance();
|
||||
if (sysMrgClient == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get SysMrgClient.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get SysMrgClient");
|
||||
return false;
|
||||
}
|
||||
auto object = sysMrgClient->GetSystemAbility(APP_MGR_SERVICE_ID);
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetAppMgr failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetAppMgr failed");
|
||||
return false;
|
||||
}
|
||||
appMgr_ = iface_cast<IAppMgr>(object);
|
||||
@ -150,7 +149,7 @@ bool ChildMainThread::ScheduleLoadJs()
|
||||
return false;
|
||||
}
|
||||
if (!processInfo_) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "processInfo is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "processInfo is nullptr");
|
||||
return false;
|
||||
}
|
||||
auto childProcessType = processInfo_->childProcessType;
|
||||
@ -158,7 +157,7 @@ bool ChildMainThread::ScheduleLoadJs()
|
||||
auto task = [weak, childProcessType]() {
|
||||
auto childMainThread = weak.promote();
|
||||
if (childMainThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "childMainThread is nullptr, ScheduleLoadJs failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "childMainThread is nullptr, ScheduleLoadJs failed");
|
||||
return;
|
||||
}
|
||||
if (childProcessType == CHILD_PROCESS_TYPE_ARK) {
|
||||
@ -168,7 +167,7 @@ bool ChildMainThread::ScheduleLoadJs()
|
||||
}
|
||||
};
|
||||
if (!mainHandler_->PostTask(task, "ChildMainThread::HandleLoadJs")) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ChildMainThread::ScheduleLoadJs PostTask task failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "PostTask task failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -178,14 +177,14 @@ void ChildMainThread::HandleLoadJs()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (!processInfo_ || !bundleInfo_) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "processInfo or bundleInfo_ is null.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "processInfo or bundleInfo_ is null");
|
||||
return;
|
||||
}
|
||||
ChildProcessManager &childProcessManager = ChildProcessManager::GetInstance();
|
||||
HapModuleInfo hapModuleInfo;
|
||||
BundleInfo bundleInfoCopy = *bundleInfo_;
|
||||
if (!childProcessManager.GetEntryHapModuleInfo(bundleInfoCopy, hapModuleInfo)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetEntryHapModuleInfo failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetEntryHapModuleInfo failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -197,13 +196,12 @@ void ChildMainThread::HandleLoadJs()
|
||||
AbilityRuntime::Runtime::DebugOption debugOption;
|
||||
childProcessManager.SetAppSpawnForkDebugOption(debugOption, processInfo_);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "StartDebugMode, isStartWithDebug is %{public}d, processName is %{public}s, "
|
||||
"isDebugApp is %{public}d, isStartWithNative is %{public}d.", processInfo_->isStartWithDebug,
|
||||
"isDebugApp is %{public}d, isStartWithNative is %{public}d", processInfo_->isStartWithDebug,
|
||||
processInfo_->processName.c_str(), processInfo_->isDebugApp, processInfo_->isStartWithNative);
|
||||
runtime_->StartDebugMode(debugOption);
|
||||
std::string srcPath;
|
||||
srcPath.append(hapModuleInfo.moduleName).append("/").append(processInfo_->srcEntry);
|
||||
childProcessManager.LoadJsFile(srcPath, hapModuleInfo, runtime_);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ChildMainThread::HandleLoadJs end.");
|
||||
ExitProcessSafely();
|
||||
}
|
||||
|
||||
@ -211,23 +209,23 @@ void ChildMainThread::HandleLoadArkTs()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (!processInfo_ || !bundleInfo_) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "processInfo or bundleInfo_ is null.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "processInfo or bundleInfo_ is null");
|
||||
return;
|
||||
}
|
||||
if (!processArgs_) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "processArgs_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "processArgs_ is nullptr");
|
||||
return;
|
||||
}
|
||||
auto &srcEntry = processInfo_->srcEntry;
|
||||
ChildProcessManager &childProcessManager = ChildProcessManager::GetInstance();
|
||||
std::string moduleName = childProcessManager.GetModuleNameFromSrcEntry(srcEntry);
|
||||
if (moduleName.empty()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Can't find module name from srcEntry, srcEntry is %{private}s.", srcEntry.c_str());
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Can't find module name from srcEntry, srcEntry is %{private}s", srcEntry.c_str());
|
||||
return;
|
||||
}
|
||||
HapModuleInfo hapModuleInfo;
|
||||
if (!childProcessManager.GetHapModuleInfo(*bundleInfo_, moduleName, hapModuleInfo)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetHapModuleInfo failed, can't find module:%{public}s.", moduleName.c_str());
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetHapModuleInfo failed, can't find module:%{public}s", moduleName.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -239,13 +237,12 @@ void ChildMainThread::HandleLoadArkTs()
|
||||
AbilityRuntime::Runtime::DebugOption debugOption;
|
||||
childProcessManager.SetAppSpawnForkDebugOption(debugOption, processInfo_);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "StartDebugMode, isStartWithDebug is %{public}d, processName is %{public}s, "
|
||||
"isDebugApp is %{public}d, isStartWithNative is %{public}d.", processInfo_->isStartWithDebug,
|
||||
"isDebugApp is %{public}d, isStartWithNative is %{public}d", processInfo_->isStartWithDebug,
|
||||
processInfo_->processName.c_str(), processInfo_->isDebugApp, processInfo_->isStartWithNative);
|
||||
runtime_->StartDebugMode(debugOption);
|
||||
|
||||
processArgs_->entryParams = processInfo_->entryParams;
|
||||
childProcessManager.LoadJsFile(srcEntry, hapModuleInfo, runtime_, processArgs_);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "HandleLoadArkTs end.");
|
||||
}
|
||||
|
||||
void ChildMainThread::InitNativeLib(const BundleInfo &bundleInfo)
|
||||
@ -265,7 +262,7 @@ void ChildMainThread::InitNativeLib(const BundleInfo &bundleInfo)
|
||||
void ChildMainThread::ExitProcessSafely()
|
||||
{
|
||||
if (appMgr_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appMgr_ is null, use exit(0) instead.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appMgr_ is null, use exit(0) instead");
|
||||
exit(0);
|
||||
return;
|
||||
}
|
||||
@ -283,13 +280,13 @@ bool ChildMainThread::ScheduleExitProcessSafely()
|
||||
auto task = [weak]() {
|
||||
auto childMainThread = weak.promote();
|
||||
if (childMainThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "childMainThread is nullptr, ScheduleExitProcessSafely failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "childMainThread is nullptr, ScheduleExitProcessSafely failed");
|
||||
return;
|
||||
}
|
||||
childMainThread->HandleExitProcessSafely();
|
||||
};
|
||||
if (!mainHandler_->PostTask(task, "ChildMainThread::HandleExitProcessSafely")) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ScheduleExitProcessSafely PostTask task failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ScheduleExitProcessSafely PostTask task failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -300,7 +297,7 @@ void ChildMainThread::HandleExitProcessSafely()
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
std::shared_ptr<EventRunner> runner = mainHandler_->GetEventRunner();
|
||||
if (runner == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "HandleExitProcessSafely get runner error.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "HandleExitProcessSafely get runner error");
|
||||
return;
|
||||
}
|
||||
int ret = runner->Stop();
|
||||
@ -325,13 +322,13 @@ bool ChildMainThread::ScheduleRunNativeProc(const sptr<IRemoteObject> &mainProce
|
||||
auto task = [weak = wptr<ChildMainThread>(this), callback = sptr<IRemoteObject>(mainProcessCb)]() {
|
||||
auto childMainThread = weak.promote();
|
||||
if (childMainThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "childMainThread is nullptr, ScheduleRunNativeProc failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "childMainThread is nullptr, ScheduleRunNativeProc failed");
|
||||
return;
|
||||
}
|
||||
childMainThread->HandleRunNativeProc(callback);
|
||||
};
|
||||
if (!mainHandler_->PostTask(task, "ChildMainThread::HandleRunNativeProc")) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "HandleRunNativeProc PostTask task failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "HandleRunNativeProc PostTask task failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -341,13 +338,12 @@ void ChildMainThread::HandleRunNativeProc(const sptr<IRemoteObject> &mainProcess
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (!processInfo_) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "processInfo is null.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "processInfo is null");
|
||||
return;
|
||||
}
|
||||
|
||||
ChildProcessManager &childProcessMgr = ChildProcessManager::GetInstance();
|
||||
childProcessMgr.LoadNativeLib(nativeLibModuleName_, processInfo_->srcEntry, mainProcessCb);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "HandleRunNativeProc end.");
|
||||
ExitProcessSafely();
|
||||
}
|
||||
|
||||
@ -397,7 +393,7 @@ void ChildMainThread::GetNativeLibPath(const BundleInfo &bundleInfo, AppLibPathM
|
||||
|
||||
for (auto &hapInfo : bundleInfo.hapModuleInfos) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT,
|
||||
"moduleName: %{public}s, isLibIsolated: %{public}d, compressNativeLibs: %{public}d.",
|
||||
"moduleName: %{public}s, isLibIsolated: %{public}d, compressNativeLibs: %{public}d",
|
||||
hapInfo.moduleName.c_str(), hapInfo.isLibIsolated, hapInfo.compressNativeLibs);
|
||||
GetHapSoPath(hapInfo, appLibPaths, hapInfo.hapPath.find(ABS_CODE_PATH));
|
||||
}
|
||||
@ -406,7 +402,7 @@ void ChildMainThread::GetNativeLibPath(const BundleInfo &bundleInfo, AppLibPathM
|
||||
void ChildMainThread::GetHapSoPath(const HapModuleInfo &hapInfo, AppLibPathMap &appLibPaths, bool isPreInstallApp)
|
||||
{
|
||||
if (hapInfo.nativeLibraryPath.empty()) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Lib path of %{public}s is empty, lib isn't isolated or compressed.",
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Lib path of %{public}s is empty, lib isn't isolated or compressed",
|
||||
hapInfo.moduleName.c_str());
|
||||
return;
|
||||
}
|
||||
@ -414,7 +410,7 @@ void ChildMainThread::GetHapSoPath(const HapModuleInfo &hapInfo, AppLibPathMap &
|
||||
std::string appLibPathKey = hapInfo.bundleName + "/" + hapInfo.moduleName;
|
||||
std::string libPath = LOCAL_CODE_PATH;
|
||||
if (!hapInfo.compressNativeLibs) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Lib of %{public}s will not be extracted from hap.", hapInfo.moduleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Lib of %{public}s will not be extracted from hap", hapInfo.moduleName.c_str());
|
||||
libPath = GetLibPath(hapInfo.hapPath, isPreInstallApp);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ const int32_t TYPE_OTHERS = 2;
|
||||
void ContextContainer::AttachBaseContext(const std::shared_ptr<ContextDeal> &base)
|
||||
{
|
||||
if (base == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextDeal::AttachBaseContext failed, base is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "base is nullptr");
|
||||
return;
|
||||
}
|
||||
baseContext_ = base;
|
||||
@ -57,7 +57,7 @@ std::shared_ptr<ProcessInfo> ContextContainer::GetProcessInfo() const
|
||||
void ContextContainer::SetProcessInfo(const std::shared_ptr<ProcessInfo> &info)
|
||||
{
|
||||
if (info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "SetProcessInfo failed, info is empty");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "info is empty");
|
||||
return;
|
||||
}
|
||||
processInfo_ = info;
|
||||
@ -68,7 +68,7 @@ std::shared_ptr<ApplicationInfo> ContextContainer::GetApplicationInfo() const
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetApplicationInfo();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetApplicationInfo baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -78,7 +78,7 @@ std::shared_ptr<Context> ContextContainer::GetApplicationContext() const
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetApplicationContext();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetApplicationContext baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -88,7 +88,7 @@ std::string ContextContainer::GetBundleCodePath()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetBundleCodePath();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetBundleCodePath baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -98,7 +98,7 @@ const std::shared_ptr<AbilityInfo> ContextContainer::GetAbilityInfo()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetAbilityInfo();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetAbilityInfo baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -108,7 +108,7 @@ std::shared_ptr<Context> ContextContainer::GetContext()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetContext();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetContext baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -118,7 +118,7 @@ std::shared_ptr<BundleMgrHelper> ContextContainer::GetBundleManager() const
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetBundleManager();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The baseContext_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -128,7 +128,7 @@ std::shared_ptr<Global::Resource::ResourceManager> ContextContainer::GetResource
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetResourceManager();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetResourceManager baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ std::string ContextContainer::GetDatabaseDir()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetDatabaseDir();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetDatabaseDir baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -148,7 +148,7 @@ std::string ContextContainer::GetDataDir()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetDataDir();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetDataDir baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -158,7 +158,7 @@ std::string ContextContainer::GetDir(const std::string &name, int mode)
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetDir(name, mode);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetDir baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -168,7 +168,7 @@ std::string ContextContainer::GetFilesDir()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetFilesDir();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetFilesDir baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,7 @@ std::string ContextContainer::GetBundleName() const
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetBundleName();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetBundleName baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -188,7 +188,7 @@ std::string ContextContainer::GetBundleResourcePath()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetBundleResourcePath();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetBundleResourcePath baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -198,7 +198,7 @@ sptr<AAFwk::IAbilityManager> ContextContainer::GetAbilityManager()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetAbilityManager();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetAbilityManager baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -208,7 +208,7 @@ std::string ContextContainer::GetAppType()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetAppType();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetAppType baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -218,7 +218,7 @@ void ContextContainer::SetPattern(int patternId)
|
||||
if (baseContext_ != nullptr) {
|
||||
baseContext_->SetPattern(patternId);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::SetPattern baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ std::shared_ptr<HapModuleInfo> ContextContainer::GetHapModuleInfo()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetHapModuleInfo();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetHapModuleInfo baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -240,7 +240,7 @@ std::string ContextContainer::GetProcessName()
|
||||
std::shared_ptr<Context> ContextContainer::CreateBundleContext(std::string bundleName, int flag, int accountId)
|
||||
{
|
||||
if (bundleName.empty()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleName is empty.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleName is empty");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -250,12 +250,12 @@ std::shared_ptr<Context> ContextContainer::CreateBundleContext(std::string bundl
|
||||
|
||||
std::shared_ptr<BundleMgrHelper> bundleMgr = GetBundleManager();
|
||||
if (bundleMgr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleMgr is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleMgr is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BundleInfo bundleInfo;
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "Length: %{public}zu, bundleName: %{public}s, accountId is %{public}d.",
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "Length: %{public}zu, bundleName: %{public}s, accountId is %{public}d",
|
||||
bundleName.length(),
|
||||
bundleName.c_str(),
|
||||
accountId);
|
||||
@ -266,7 +266,7 @@ std::shared_ptr<Context> ContextContainer::CreateBundleContext(std::string bundl
|
||||
bundleMgr->GetBundleInfo(bundleName, BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, realAccountId);
|
||||
|
||||
if (bundleInfo.name.empty() || bundleInfo.applicationInfo.name.empty()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get Bundle Info.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get Bundle Info");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ void ContextContainer::InitResourceManager(BundleInfo &bundleInfo, std::shared_p
|
||||
std::shared_ptr<Global::Resource::ResourceManager> resourceManager(Global::Resource::CreateResourceManager(
|
||||
bundleInfo.name, moduleName, hapPath, overlayPaths, *resConfig, appType));
|
||||
if (resourceManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextImpl::InitResourceManager failed to create resourceManager");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed to create resourceManager");
|
||||
return;
|
||||
}
|
||||
deal->initResourceManager(resourceManager);
|
||||
@ -316,7 +316,7 @@ void ContextContainer::InitResourceManager(BundleInfo &bundleInfo, std::shared_p
|
||||
std::shared_ptr<Global::Resource::ResourceManager> resourceManager(Global::Resource::CreateResourceManager(
|
||||
bundleInfo.name, moduleName, hapPath, overlayPaths, *resConfig, appType));
|
||||
if (resourceManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::InitResourceManager create resourceManager failed");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "create resourceManager failed");
|
||||
return;
|
||||
}
|
||||
LoadResources(bundleInfo, resourceManager, resConfig, deal);
|
||||
@ -326,7 +326,7 @@ void ContextContainer::LoadResources(BundleInfo &bundleInfo,
|
||||
std::shared_ptr<Global::Resource::ResourceManager> &resourceManager,
|
||||
std::unique_ptr<Global::Resource::ResConfig> &resConfig, std::shared_ptr<ContextDeal> &deal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ContextContainer::InitResourceManager hapModuleInfos count: %{public}zu",
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "hapModuleInfos count: %{public}zu",
|
||||
bundleInfo.hapModuleInfos.size());
|
||||
std::regex pattern(AbilityBase::Constants::ABS_CODE_PATH);
|
||||
for (auto hapModuleInfo : bundleInfo.hapModuleInfos) {
|
||||
@ -340,7 +340,7 @@ void ContextContainer::LoadResources(BundleInfo &bundleInfo,
|
||||
continue;
|
||||
}
|
||||
loadPath = std::regex_replace(loadPath, pattern, AbilityBase::Constants::LOCAL_BUNDLES);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ContextContainer::InitResourceManager loadPath: %{public}s", loadPath.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "loadPath: %{private}s", loadPath.c_str());
|
||||
if (!resourceManager->AddResource(loadPath.c_str())) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::InitResourceManager AddResource failed");
|
||||
}
|
||||
@ -350,12 +350,12 @@ void ContextContainer::LoadResources(BundleInfo &bundleInfo,
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
if (resConfig->GetLocaleInfo() != nullptr) {
|
||||
TAG_LOGI(AAFwkTag::APPKIT,
|
||||
"ContextContainer::InitResourceManager language: %{public}s, script: %{public}s, region: %{public}s,",
|
||||
"language: %{public}s, script: %{public}s, region: %{public}s,",
|
||||
resConfig->GetLocaleInfo()->getLanguage(),
|
||||
resConfig->GetLocaleInfo()->getScript(),
|
||||
resConfig->GetLocaleInfo()->getCountry());
|
||||
} else {
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "ContextContainer::InitResourceManager language: GetLocaleInfo is null.");
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "language: GetLocaleInfo is null.");
|
||||
}
|
||||
#endif
|
||||
resourceManager->UpdateResConfig(*resConfig);
|
||||
@ -379,7 +379,7 @@ std::string ContextContainer::GetString(int resId)
|
||||
std::string ret = baseContext_->GetString(resId);
|
||||
return ret;
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetString baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetString baseContext_ is nullptr");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -389,7 +389,7 @@ std::vector<std::string> ContextContainer::GetStringArray(int resId)
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetStringArray(resId);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetStringArray baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
}
|
||||
@ -399,7 +399,7 @@ std::vector<int> ContextContainer::GetIntArray(int resId)
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetIntArray(resId);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetIntArray baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return std::vector<int>();
|
||||
}
|
||||
}
|
||||
@ -409,7 +409,7 @@ std::map<std::string, std::string> ContextContainer::GetTheme()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetTheme();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetTheme baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return std::map<std::string, std::string>();
|
||||
}
|
||||
}
|
||||
@ -419,7 +419,7 @@ void ContextContainer::SetTheme(int themeId)
|
||||
if (baseContext_ != nullptr) {
|
||||
baseContext_->SetTheme(themeId);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::SetTheme baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
}
|
||||
}
|
||||
|
||||
@ -428,7 +428,7 @@ std::map<std::string, std::string> ContextContainer::GetPattern()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetPattern();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetPattern baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return std::map<std::string, std::string>();
|
||||
}
|
||||
}
|
||||
@ -438,7 +438,7 @@ int ContextContainer::GetColor(int resId)
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetColor(resId);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetColor baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return INVALID_RESOURCE_VALUE;
|
||||
}
|
||||
}
|
||||
@ -448,7 +448,7 @@ int ContextContainer::GetThemeId()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetThemeId();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetThemeId baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -458,7 +458,7 @@ int ContextContainer::GetDisplayOrientation()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetDisplayOrientation();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetDisplayOrientation baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return static_cast<int>(DisplayOrientation::UNSPECIFIED);
|
||||
}
|
||||
}
|
||||
@ -468,7 +468,7 @@ std::string ContextContainer::GetPreferencesDir()
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetPreferencesDir();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetPreferencesDir baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -476,7 +476,7 @@ std::string ContextContainer::GetPreferencesDir()
|
||||
void ContextContainer::SetColorMode(int mode)
|
||||
{
|
||||
if (baseContext_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::SetColorMode baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -486,7 +486,7 @@ void ContextContainer::SetColorMode(int mode)
|
||||
int ContextContainer::GetColorMode()
|
||||
{
|
||||
if (baseContext_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextContainer::GetColorMode baseContext_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "baseContext_ is nullptr");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ std::shared_ptr<ApplicationInfo> ContextDeal::GetApplicationInfo() const
|
||||
void ContextDeal::SetApplicationInfo(const std::shared_ptr<ApplicationInfo> &info)
|
||||
{
|
||||
if (info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "SetApplicationInfo failed, info is empty");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "info is empty");
|
||||
return;
|
||||
}
|
||||
applicationInfo_ = info;
|
||||
@ -70,7 +70,7 @@ std::shared_ptr<Context> ContextDeal::GetApplicationContext() const
|
||||
void ContextDeal::SetApplicationContext(const std::shared_ptr<Context> &context)
|
||||
{
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "SetApplicationContext failed, context is empty");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is empty");
|
||||
return;
|
||||
}
|
||||
appContext_ = context;
|
||||
@ -105,7 +105,7 @@ const std::shared_ptr<AbilityInfo> ContextDeal::GetAbilityInfo()
|
||||
void ContextDeal::SetAbilityInfo(const std::shared_ptr<AbilityInfo> &info)
|
||||
{
|
||||
if (info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "SetAbilityInfo failed, info is empty");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "info is empty");
|
||||
return;
|
||||
}
|
||||
abilityInfo_ = info;
|
||||
@ -119,7 +119,7 @@ std::shared_ptr<Context> ContextDeal::GetContext()
|
||||
void ContextDeal::SetContext(const std::shared_ptr<Context> &context)
|
||||
{
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The context is empty.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is empty.");
|
||||
return;
|
||||
}
|
||||
abilityContext_ = context;
|
||||
@ -165,7 +165,7 @@ std::string ContextDeal::GetDataDir()
|
||||
std::string ContextDeal::GetDir(const std::string &name, int mode)
|
||||
{
|
||||
if (applicationInfo_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetDir failed, applicationInfo_ == nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "applicationInfo_ == nullptr");
|
||||
return "";
|
||||
}
|
||||
std::string dir = applicationInfo_->dataDir + CONTEXT_DEAL_FILE_SEPARATOR + name;
|
||||
@ -305,7 +305,7 @@ std::string ContextDeal::GetString(int resId)
|
||||
std::vector<std::string> ContextDeal::GetStringArray(int resId)
|
||||
{
|
||||
if (resourceManager_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetStringArray resourceManager_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "resourceManager_ is nullptr");
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ std::vector<std::string> ContextDeal::GetStringArray(int resId)
|
||||
if (errval == OHOS::Global::Resource::RState::SUCCESS) {
|
||||
return retv;
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetStringArray GetStringArrayById(resId:%d) retval is %u", resId, errval);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetStringArrayById(resId:%d) retval is %u", resId, errval);
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
}
|
||||
@ -347,13 +347,13 @@ std::map<std::string, std::string> ContextDeal::GetTheme()
|
||||
void ContextDeal::SetTheme(int themeId)
|
||||
{
|
||||
if (resourceManager_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "SetTheme resourceManager_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "resourceManager_ is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
auto hapModInfo = GetHapModuleInfo();
|
||||
if (hapModInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "SetTheme hapModInfo is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "hapModInfo is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -407,10 +407,9 @@ int ContextDeal::GetThemeId()
|
||||
int ContextDeal::GetDisplayOrientation()
|
||||
{
|
||||
if (abilityInfo_ != nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "GetDisplayOrientation end");
|
||||
return static_cast<int>(abilityInfo_->orientation);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "GetDisplayOrientation abilityInfo_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityInfo_ is nullptr");
|
||||
return static_cast<int>(DisplayOrientation::UNSPECIFIED);
|
||||
}
|
||||
}
|
||||
|
@ -30,18 +30,18 @@ DumpRuntimeHelper::DumpRuntimeHelper(const std::shared_ptr<OHOSApplication> &app
|
||||
void DumpRuntimeHelper::SetAppFreezeFilterCallback()
|
||||
{
|
||||
if (application_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "SetAppFreezeFilterCallback OHOSApplication is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "OHOSApplication is nullptr");
|
||||
return;
|
||||
}
|
||||
auto& runtime = application_->GetRuntime();
|
||||
if (runtime == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "SetAppFreezeFilterCallback GetRuntime is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Runtime is nullptr");
|
||||
return;
|
||||
}
|
||||
auto appfreezeFilterCallback = [] (const int32_t pid) -> bool {
|
||||
auto client = DelayedSingleton<AppExecFwk::AppMgrClient>::GetInstance();
|
||||
if (client == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "SetAppFreezeFilterCallback client is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "client is nullptr");
|
||||
return false;
|
||||
}
|
||||
return client->SetAppFreezeFilter(pid);
|
||||
|
@ -117,7 +117,7 @@ bool ExtensionPluginInfo::ScanExtensions(std::vector<std::string>& files)
|
||||
std::string dirPath = EXTENSION_LIB;
|
||||
DIR *dirp = opendir(dirPath.c_str());
|
||||
if (dirp == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ExtensionPluginInfo::ScanDir open dir:%{public}s fail", dirPath.c_str());
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ScanDir open dir:%{public}s fail", dirPath.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ bool ExtensionPluginInfo::ScanExtensions(std::vector<std::string>& files)
|
||||
|
||||
bool ExtensionPluginInfo::CheckFileType(const std::string& fileName, const std::string& extensionName)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ExtensionPluginInfo::CheckFileType path is %{public}s, support suffix is %{public}s",
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "CheckFileType path is %{public}s, support suffix is %{public}s",
|
||||
fileName.c_str(),
|
||||
extensionName.c_str());
|
||||
|
||||
|
@ -48,7 +48,7 @@ void IdleTime::InitVSyncReceiver()
|
||||
auto& rsClient = Rosen::RSInterfaces::GetInstance();
|
||||
receiver_ = rsClient.CreateVSyncReceiver("ABILITY", eventHandler_);
|
||||
if (receiver_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Create VSync receiver failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Create VSync receiver failed");
|
||||
return;
|
||||
}
|
||||
receiver_->Init();
|
||||
@ -59,12 +59,12 @@ void IdleTime::InitVSyncReceiver()
|
||||
void IdleTime::EventTask()
|
||||
{
|
||||
if (receiver_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "no VSyncReceiver.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "no VSyncReceiver");
|
||||
return;
|
||||
}
|
||||
|
||||
if (callback_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "no callback_.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "no callback_");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -99,14 +99,14 @@ void IdleTime::PostTask()
|
||||
}
|
||||
|
||||
if (eventHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "eventHandler_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "eventHandler_ is nullptr");
|
||||
return;
|
||||
}
|
||||
std::weak_ptr<IdleTime> weak(shared_from_this());
|
||||
auto task = [weak]() {
|
||||
auto idleTime = weak.lock();
|
||||
if (idleTime == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "idleTime is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "idleTime is nullptr");
|
||||
return;
|
||||
}
|
||||
idleTime->EventTask();
|
||||
|
@ -178,7 +178,7 @@ std::string GetLibPath(const std::string &hapPath, bool isPreInstallApp)
|
||||
void GetHapSoPath(const HapModuleInfo &hapInfo, AppLibPathMap &appLibPaths, bool isPreInstallApp)
|
||||
{
|
||||
if (hapInfo.nativeLibraryPath.empty()) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Lib path of %{public}s is empty, lib isn't isolated or compressed.",
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Lib path of %{public}s is empty, lib isn't isolated or compressed",
|
||||
hapInfo.moduleName.c_str());
|
||||
return;
|
||||
}
|
||||
@ -186,7 +186,7 @@ void GetHapSoPath(const HapModuleInfo &hapInfo, AppLibPathMap &appLibPaths, bool
|
||||
std::string appLibPathKey = hapInfo.bundleName + "/" + hapInfo.moduleName;
|
||||
std::string libPath = LOCAL_CODE_PATH;
|
||||
if (!hapInfo.compressNativeLibs) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Lib of %{public}s will not be extracted from hap.", hapInfo.moduleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Lib of %{public}s will not be extracted from hap", hapInfo.moduleName.c_str());
|
||||
libPath = GetLibPath(hapInfo.hapPath, isPreInstallApp);
|
||||
}
|
||||
|
||||
@ -230,12 +230,12 @@ void GetPatchNativeLibPath(const HapModuleInfo &hapInfo, std::string &patchNativ
|
||||
}
|
||||
|
||||
if (patchNativeLibraryPath.empty()) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Patch lib path of %{public}s is empty.", hapInfo.moduleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Patch lib path of %{public}s is empty", hapInfo.moduleName.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (hapInfo.compressNativeLibs && !hapInfo.isLibIsolated) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Lib of %{public}s has compressed and isn't isolated, no need to set.",
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Lib of %{public}s has compressed and isn't isolated, no need to set",
|
||||
hapInfo.moduleName.c_str());
|
||||
return;
|
||||
}
|
||||
@ -294,12 +294,11 @@ void MainThread::GetNativeLibPath(const BundleInfo &bundleInfo, const HspList &h
|
||||
*/
|
||||
void AppMgrDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
|
||||
{
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "MainThread::AppMgrDeathRecipient remote died receive");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "remote died receive");
|
||||
}
|
||||
|
||||
MainThread::MainThread()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
#ifdef ABILITY_LIBRARY_LOADER
|
||||
fileEntries_.clear();
|
||||
nativeFileEntries_.clear();
|
||||
@ -642,12 +641,12 @@ void MainThread::ScheduleJsHeapMemory(OHOS::AppExecFwk::JsHeapDumpInfo &info)
|
||||
info.pid, info.tid, info.needGc, info.needSnapshot);
|
||||
auto app = applicationForDump_.lock();
|
||||
if (app == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ScheduleJsHeapMemory app nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "app nullptr");
|
||||
return;
|
||||
}
|
||||
auto &runtime = app->GetRuntime();
|
||||
if (runtime == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ScheduleJsHeapMemory runtime nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime nullptr");
|
||||
return;
|
||||
}
|
||||
if (info.needSnapshot == true) {
|
||||
@ -666,7 +665,6 @@ void MainThread::ScheduleJsHeapMemory(OHOS::AppExecFwk::JsHeapDumpInfo &info)
|
||||
*/
|
||||
void MainThread::ScheduleProcessSecurityExit()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ScheduleProcessSecurityExit called");
|
||||
wptr<MainThread> weak = this;
|
||||
auto task = [weak]() {
|
||||
auto appThread = weak.promote();
|
||||
@ -705,9 +703,7 @@ void MainThread::ScheduleClearPageStack()
|
||||
*
|
||||
*/
|
||||
void MainThread::ScheduleLowMemory()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "MainThread::scheduleLowMemory called");
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1075,27 +1071,27 @@ bool MainThread::InitResourceManager(std::shared_ptr<Global::Resource::ResourceM
|
||||
}
|
||||
#endif
|
||||
std::string colormode = config.GetItem(AAFwk::GlobalConfigurationKey::SYSTEM_COLORMODE);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Colormode is %{public}s.", colormode.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Colormode is %{public}s", colormode.c_str());
|
||||
resConfig->SetColorMode(ConvertColorMode(colormode));
|
||||
|
||||
std::string hasPointerDevice = config.GetItem(AAFwk::GlobalConfigurationKey::INPUT_POINTER_DEVICE);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "HasPointerDevice is %{public}s.", hasPointerDevice.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "HasPointerDevice is %{public}s", hasPointerDevice.c_str());
|
||||
resConfig->SetInputDevice(ConvertHasPointerDevice(hasPointerDevice));
|
||||
|
||||
std::string deviceType = config.GetItem(AAFwk::GlobalConfigurationKey::DEVICE_TYPE);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "deviceType is %{public}s <----> %{public}d.", deviceType.c_str(),
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "deviceType is %{public}s <----> %{public}d", deviceType.c_str(),
|
||||
ConvertDeviceType(deviceType));
|
||||
resConfig->SetDeviceType(ConvertDeviceType(deviceType));
|
||||
|
||||
std::string mcc = config.GetItem(AAFwk::GlobalConfigurationKey::SYSTEM_MCC);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "mcc is %{public}s.", mcc.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "mcc is %{public}s", mcc.c_str());
|
||||
uint32_t mccNum = 0;
|
||||
if (AbilityRuntime::ResourceConfigHelper::ConvertStringToUint32(mcc, mccNum)) {
|
||||
resConfig->SetMcc(mccNum);
|
||||
}
|
||||
|
||||
std::string mnc = config.GetItem(AAFwk::GlobalConfigurationKey::SYSTEM_MNC);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "mnc is %{public}s.", mnc.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "mnc is %{public}s", mnc.c_str());
|
||||
uint32_t mncNum = 0;
|
||||
if (AbilityRuntime::ResourceConfigHelper::ConvertStringToUint32(mnc, mncNum)) {
|
||||
resConfig->SetMnc(mncNum);
|
||||
@ -1118,7 +1114,7 @@ void MainThread::OnStartAbility(const std::string &bundleName,
|
||||
// getOverlayPath
|
||||
auto res = GetOverlayModuleInfos(bundleName, entryHapModuleInfo.moduleName, overlayModuleInfos_);
|
||||
if (res != ERR_OK) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "getOverlayPath failed.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "getOverlayPath failed");
|
||||
}
|
||||
if (overlayModuleInfos_.size() == 0) {
|
||||
if (!resourceManager->AddResource(loadPath.c_str())) {
|
||||
@ -1126,7 +1122,7 @@ void MainThread::OnStartAbility(const std::string &bundleName,
|
||||
}
|
||||
} else {
|
||||
std::vector<std::string> overlayPaths = GetOverlayPaths(bundleName, overlayModuleInfos_);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "OverlayPaths size:%{public}zu.", overlayPaths.size());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "OverlayPaths size:%{public}zu", overlayPaths.size());
|
||||
if (!resourceManager->AddResource(loadPath, overlayPaths)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "AddResource failed");
|
||||
}
|
||||
@ -1175,10 +1171,10 @@ void MainThread::SubscribeOverlayChange(const std::string &bundleName, const std
|
||||
wptr<MainThread> weak = this;
|
||||
auto callback = [weak, resourceManager, bundleName, moduleName = entryHapModuleInfo.moduleName,
|
||||
loadPath](const EventFwk::CommonEventData &data) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "On overlay changed.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "On overlay changed");
|
||||
auto appThread = weak.promote();
|
||||
if (appThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityThread is nullptr, SetRunnerStarted failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityThread is nullptr, SetRunnerStarted failed");
|
||||
return;
|
||||
}
|
||||
appThread->OnOverlayChanged(data, resourceManager, bundleName, moduleName, loadPath);
|
||||
@ -1192,9 +1188,8 @@ void MainThread::OnOverlayChanged(const EventFwk::CommonEventData &data,
|
||||
const std::shared_ptr<Global::Resource::ResourceManager> &resourceManager, const std::string &bundleName,
|
||||
const std::string &moduleName, const std::string &loadPath)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin.");
|
||||
if (mainHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "mainHandler is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "mainHandler is nullptr");
|
||||
return;
|
||||
}
|
||||
wptr<MainThread> weak = this;
|
||||
@ -1215,11 +1210,11 @@ void MainThread::HandleOnOverlayChanged(const EventFwk::CommonEventData &data,
|
||||
const std::shared_ptr<Global::Resource::ResourceManager> &resourceManager, const std::string &bundleName,
|
||||
const std::string &moduleName, const std::string &loadPath)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
auto want = data.GetWant();
|
||||
std::string action = want.GetAction();
|
||||
if (action != OVERLAY_STATE_CHANGED) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Not this subscribe, action: %{public}s.", action.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Not this subscribe, action: %{public}s", action.c_str());
|
||||
return;
|
||||
}
|
||||
bool isEnable = data.GetWant().GetBoolParam(Constants::OVERLAY_STATE, false);
|
||||
@ -1276,11 +1271,11 @@ bool GetBundleForLaunchApplication(std::shared_ptr<BundleMgrHelper> bundleMgrHel
|
||||
{
|
||||
bool queryResult;
|
||||
if (appIndex > AbilityRuntime::GlobalConstant::MAX_APP_CLONE_INDEX) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "The bundleName = %{public}s.", bundleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "The bundleName = %{public}s", bundleName.c_str());
|
||||
queryResult = (bundleMgrHelper->GetSandboxBundleInfo(bundleName,
|
||||
appIndex, UNSPECIFIED_USERID, bundleInfo) == 0);
|
||||
} else {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "The bundleName = %{public}s.", bundleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "The bundleName = %{public}s", bundleName.c_str());
|
||||
queryResult = (bundleMgrHelper->GetBundleInfoForSelf(
|
||||
(static_cast<int32_t>(GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY) +
|
||||
static_cast<int32_t>(GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_HAP_MODULE) +
|
||||
@ -1306,7 +1301,7 @@ CJUncaughtExceptionInfo MainThread::CreateCjExceptionInfo(const std::string &bun
|
||||
(std::string summary, const CJErrorObject errorObj) {
|
||||
auto appThread = weak_this.promote();
|
||||
if (appThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appThread is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appThread is nullptr");
|
||||
return;
|
||||
}
|
||||
time_t timet;
|
||||
@ -1359,9 +1354,8 @@ CJUncaughtExceptionInfo MainThread::CreateCjExceptionInfo(const std::string &bun
|
||||
void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, const Configuration &config)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "called");
|
||||
if (!CheckForHandleLaunchApplication(appLaunchData)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CheckForHandleLaunchApplication failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CheckForHandleLaunchApplication failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1373,15 +1367,15 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
|
||||
auto appInfo = appLaunchData.GetApplicationInfo();
|
||||
ProcessInfo processInfo = appLaunchData.GetProcessInfo();
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "InitCreate Start.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "InitCreate Start");
|
||||
std::shared_ptr<ContextDeal> contextDeal;
|
||||
if (!InitCreate(contextDeal, appInfo, processInfo)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "InitCreate failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "InitCreate failed");
|
||||
return;
|
||||
}
|
||||
auto bundleMgrHelper = contextDeal->GetBundleManager();
|
||||
if (bundleMgrHelper == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleMgrHelper is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleMgrHelper is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1393,7 +1387,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
}
|
||||
BundleInfo bundleInfo;
|
||||
if (!GetBundleForLaunchApplication(bundleMgrHelper, bundleName, appLaunchData.GetAppIndex(), bundleInfo)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get bundle info.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Failed to get bundle info");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1413,7 +1407,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
}
|
||||
}
|
||||
if (!findEntryHapModuleInfo) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "HandleLaunchApplication find entry hap module info failed!");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "HandleLaunchApplication find entry hap module info failed");
|
||||
entryHapModuleInfo = bundleInfo.hapModuleInfos.back();
|
||||
}
|
||||
#ifdef CJ_FRONTEND
|
||||
@ -1482,8 +1476,6 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
application_->SetApplicationContext(applicationContext);
|
||||
|
||||
#ifdef SUPPORT_SCREEN
|
||||
TAG_LOGI(
|
||||
AAFwkTag::APPKIT, "HandleLaunchApplication cacheDir: %{public}s", applicationContext->GetCacheDir().c_str());
|
||||
OHOS::EglSetCacheDir(applicationContext->GetCacheDir());
|
||||
#endif
|
||||
|
||||
@ -1491,7 +1483,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
ErrCode ret = bundleMgrHelper->GetBaseSharedBundleInfos(appInfo.bundleName, hspList,
|
||||
AppExecFwk::GetDependentBundleInfoFlag::GET_ALL_DEPENDENT_BUNDLE_INFO);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get base shared bundle infos failed: %{public}d.", ret);
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get base shared bundle infos failed: %{public}d", ret);
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> pkgContextInfoJsonStringMap;
|
||||
@ -1622,7 +1614,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
pid, processName] (std::string summary, const JsEnv::ErrorObject errorObj) {
|
||||
auto appThread = weak.promote();
|
||||
if (appThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appThread is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appThread is nullptr");
|
||||
return;
|
||||
}
|
||||
time_t timet;
|
||||
@ -1652,7 +1644,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "hisysevent write result=%{public}d, send event [FRAMEWORK,PROCESS_KILL],"
|
||||
" pid=%{public}d, processName=%{public}s, msg=%{public}s", result, pid, processName.c_str(),
|
||||
KILL_REASON);
|
||||
|
||||
|
||||
if (ApplicationDataManager::GetInstance().NotifyUnhandledException(summary) &&
|
||||
ApplicationDataManager::GetInstance().NotifyExceptionObject(appExecErrorObj)) {
|
||||
return;
|
||||
@ -1672,6 +1664,16 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
(static_cast<AbilityRuntime::CJRuntime&>(*runtime)).RegisterUncaughtExceptionHandler(expectionInfo);
|
||||
}
|
||||
#endif
|
||||
wptr<MainThread> weak = this;
|
||||
auto callback = [weak](const AAFwk::ExitReason &exitReason) {
|
||||
auto appThread = weak.promote();
|
||||
if (appThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Main thread is nullptr");
|
||||
}
|
||||
AbilityManagerClient::GetInstance()->RecordAppExitReason(exitReason);
|
||||
appThread->ScheduleProcessSecurityExit();
|
||||
};
|
||||
applicationContext->RegisterProcessSecurityExit(callback);
|
||||
|
||||
application_->SetRuntime(std::move(runtime));
|
||||
|
||||
@ -1682,7 +1684,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
if (app != nullptr) {
|
||||
return AbilityRuntime::UIAbility::Create(app->GetRuntime());
|
||||
}
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed");
|
||||
return nullptr;
|
||||
});
|
||||
#ifdef CJ_FRONTEND
|
||||
@ -1696,12 +1698,12 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
IdleTimeCallback callback = [wpApplication](int32_t idleTime) {
|
||||
auto app = wpApplication.lock();
|
||||
if (app == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "app is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "app is nullptr");
|
||||
return;
|
||||
}
|
||||
auto &runtime = app->GetRuntime();
|
||||
if (runtime == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime is nullptr");
|
||||
return;
|
||||
}
|
||||
auto& nativeEngine = (static_cast<AbilityRuntime::JsRuntime&>(*runtime)).GetNativeEngine();
|
||||
@ -1729,7 +1731,6 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
}
|
||||
|
||||
// init resourceManager.
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "CreateResourceManager Start.");
|
||||
|
||||
auto moduleName = entryHapModuleInfo.moduleName;
|
||||
std::string loadPath =
|
||||
@ -1839,18 +1840,18 @@ void MainThread::CalcNativeLiabraryEntries(const BundleInfo &bundleInfo, std::st
|
||||
libPath.push_back('/');
|
||||
}
|
||||
for (const auto &entryName : item.nativeLibraryFileNames) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "add entry: %{public}s.", entryName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "add entry: %{public}s", entryName.c_str());
|
||||
nativeFileEntries.emplace_back(libPath + entryName);
|
||||
}
|
||||
} else {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "compressNativeLibs flag true for: %{public}s.", item.moduleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "compressNativeLibs flag true for: %{public}s", item.moduleName.c_str());
|
||||
loadSoFromDir = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (loadSoFromDir) {
|
||||
if (nativeLibraryPath.empty()) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "Native library path is empty.");
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "Native library path is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1971,7 +1972,7 @@ void MainThread::HandleAbilityStage(const HapModuleInfo &abilityStage)
|
||||
void MainThread::LoadAllExtensions(NativeEngine &nativeEngine)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "LoadAllExtensions.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "LoadAllExtensions");
|
||||
if (!extensionConfigMgr_) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ExtensionConfigMgr is invalid");
|
||||
return;
|
||||
@ -1979,7 +1980,7 @@ void MainThread::LoadAllExtensions(NativeEngine &nativeEngine)
|
||||
|
||||
auto extensionPlugins = AbilityRuntime::ExtensionPluginInfo::GetInstance().GetExtensionPlugins();
|
||||
if (extensionPlugins.empty()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "no extension type map.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "no extension type map");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2013,14 +2014,14 @@ bool MainThread::PrepareAbilityDelegator(const std::shared_ptr<UserTestRecord> &
|
||||
}
|
||||
auto args = std::make_shared<AbilityDelegatorArgs>(record->want);
|
||||
if (isStageBased) { // Stage model
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Stage model.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Stage model");
|
||||
auto testRunner = TestRunner::Create(application_->GetRuntime(), args, false);
|
||||
auto delegator = std::make_shared<AbilityDelegator>(
|
||||
application_->GetAppContext(), std::move(testRunner), record->observer);
|
||||
AbilityDelegatorRegistry::RegisterInstance(delegator, args);
|
||||
delegator->Prepare();
|
||||
} else { // FA model
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "FA model.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "FA model");
|
||||
AbilityRuntime::Runtime::Options options;
|
||||
options.codePath = LOCAL_CODE_PATH;
|
||||
options.eventRunner = mainHandler_->GetEventRunner();
|
||||
@ -2070,7 +2071,7 @@ void MainThread::HandleLaunchAbility(const std::shared_ptr<AbilityLocalRecord> &
|
||||
if (abilityRecord->GetWant() != nullptr) {
|
||||
traceName += abilityRecord->GetWant()->GetElement().GetBundleName();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Want is nullptr, cant not get abilityName.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Want is nullptr, cant not get abilityName");
|
||||
}
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, traceName);
|
||||
CHECK_POINTER_LOG(applicationImpl_, "applicationImpl_ is null");
|
||||
@ -2143,7 +2144,7 @@ void MainThread::HandleLaunchAbility(const std::shared_ptr<AbilityLocalRecord> &
|
||||
*/
|
||||
void MainThread::HandleCleanAbilityLocal(const sptr<IRemoteObject> &token)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start");
|
||||
if (!IsApplicationReady()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "should launch application first");
|
||||
return;
|
||||
@ -2256,7 +2257,7 @@ void MainThread::HandleForegroundApplication()
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "called");
|
||||
if ((application_ == nullptr) || (appMgr_ == nullptr)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "MainThread::handleForegroundApplication error!");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "handleForegroundApplication error!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2281,10 +2282,10 @@ void MainThread::HandleForegroundApplication()
|
||||
void MainThread::HandleBackgroundApplication()
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "start.");
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "start");
|
||||
|
||||
if ((application_ == nullptr) || (appMgr_ == nullptr)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "error!");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "error");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2309,14 +2310,14 @@ void MainThread::HandleBackgroundApplication()
|
||||
void MainThread::HandleTerminateApplication(bool isLastProcess)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start");
|
||||
if ((application_ == nullptr) || (appMgr_ == nullptr)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "error!");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!applicationImpl_->PerformTerminate(isLastProcess)) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "PerformTerminate() failed.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "PerformTerminate() failed");
|
||||
}
|
||||
|
||||
std::shared_ptr<EventRunner> runner = mainHandler_->GetEventRunner();
|
||||
@ -2348,7 +2349,6 @@ void MainThread::HandleTerminateApplication(bool isLastProcess)
|
||||
void MainThread::HandleShrinkMemory(const int level)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start.");
|
||||
|
||||
if (applicationImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "applicationImpl_ is null");
|
||||
@ -2368,7 +2368,7 @@ void MainThread::HandleShrinkMemory(const int level)
|
||||
void MainThread::HandleMemoryLevel(int level)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start");
|
||||
|
||||
if (application_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "application_ is null");
|
||||
@ -2388,8 +2388,6 @@ void MainThread::HandleMemoryLevel(int level)
|
||||
void MainThread::HandleConfigurationUpdated(const Configuration &config)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start.");
|
||||
|
||||
if (applicationImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "applicationImpl_ is null");
|
||||
return;
|
||||
@ -2401,7 +2399,7 @@ void MainThread::HandleConfigurationUpdated(const Configuration &config)
|
||||
void MainThread::TaskTimeoutDetected(const std::shared_ptr<EventRunner> &runner)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start");
|
||||
|
||||
auto deliveryTimeoutCallback = []() {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "delivery timeout");
|
||||
@ -2498,19 +2496,19 @@ void MainThread::HandleSignal(int signal, [[maybe_unused]] siginfo_t *siginfo, v
|
||||
|
||||
void MainThread::HandleDumpHeapPrepare()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "HandleDumpHeapPrepare start.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start");
|
||||
if (mainHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "HandleDumpHeapPrepare failed, mainHandler is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "mainHandler is nullptr");
|
||||
return;
|
||||
}
|
||||
auto app = applicationForDump_.lock();
|
||||
if (app == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "HandleDumpHeapPrepare app is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "app is nullptr");
|
||||
return;
|
||||
}
|
||||
auto &runtime = app->GetRuntime();
|
||||
if (runtime == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "HandleDumpHeapPrepare runtime is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime is nullptr");
|
||||
return;
|
||||
}
|
||||
runtime->GetHeapPrepare();
|
||||
@ -2518,23 +2516,23 @@ void MainThread::HandleDumpHeapPrepare()
|
||||
|
||||
void MainThread::HandleDumpHeap(bool isPrivate)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "HandleDump Heap start.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start");
|
||||
if (mainHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "HandleDumpHeap failed, mainHandler is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "mainHandler is nullptr");
|
||||
return;
|
||||
}
|
||||
auto app = applicationForDump_.lock();
|
||||
if (app == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "HandleDumpHeap app is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "app is nullptr");
|
||||
return;
|
||||
}
|
||||
auto &runtime = app->GetRuntime();
|
||||
if (runtime == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "HandleDumpHeap runtime is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime is nullptr");
|
||||
return;
|
||||
}
|
||||
auto taskFork = [&runtime, &isPrivate] {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "HandleDump Heap taskFork start.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "HandleDump Heap taskFork start");
|
||||
time_t startTime = time(nullptr);
|
||||
int pid = -1;
|
||||
if ((pid = fork()) < 0) {
|
||||
@ -2582,7 +2580,7 @@ void MainThread::DestroyHeapProfiler()
|
||||
auto task = [] {
|
||||
auto app = applicationForDump_.lock();
|
||||
if (app == nullptr || app->GetRuntime() == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime is nullptr");
|
||||
return;
|
||||
}
|
||||
app->GetRuntime()->DestroyHeapProfiler();
|
||||
@ -2592,7 +2590,7 @@ void MainThread::DestroyHeapProfiler()
|
||||
|
||||
void MainThread::ForceFullGC()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Force fullGC.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Force fullGC");
|
||||
if (mainHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "mainHandler is nullptr");
|
||||
return;
|
||||
@ -2601,7 +2599,7 @@ void MainThread::ForceFullGC()
|
||||
auto task = [] {
|
||||
auto app = applicationForDump_.lock();
|
||||
if (app == nullptr || app->GetRuntime() == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime is nullptr");
|
||||
return;
|
||||
}
|
||||
app->GetRuntime()->ForceFullGC();
|
||||
@ -2612,7 +2610,7 @@ void MainThread::ForceFullGC()
|
||||
void MainThread::Start()
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "App main thread create, pid:%{public}d.", getprocpid());
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "App main thread create, pid:%{public}d", getprocpid());
|
||||
|
||||
std::shared_ptr<EventRunner> runner = EventRunner::GetMainEventRunner();
|
||||
if (runner == nullptr) {
|
||||
@ -2647,7 +2645,6 @@ void MainThread::StartChild(const std::map<std::string, int32_t> &fds)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "MainThread StartChild, fds size:%{public}zu", fds.size());
|
||||
ChildMainThread::Start(fds);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "MainThread::ChildMainThread end.");
|
||||
}
|
||||
|
||||
void MainThread::PreloadExtensionPlugin()
|
||||
@ -2707,7 +2704,7 @@ void MainThread::LoadAbilityLibrary(const std::vector<std::string> &libraryPaths
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
#ifdef ABILITY_LIBRARY_LOADER
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start");
|
||||
#ifdef SUPPORT_SCREEN
|
||||
LoadAceAbilityLibrary();
|
||||
#endif
|
||||
@ -2725,7 +2722,7 @@ void MainThread::LoadAbilityLibrary(const std::vector<std::string> &libraryPaths
|
||||
}
|
||||
|
||||
if (fileEntries_.empty()) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "No ability library");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "No ability library");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2979,18 +2976,18 @@ int32_t MainThread::ScheduleNotifyLoadRepairPatch(const std::string &bundleName,
|
||||
std::vector<std::pair<std::string, std::string>> hqfFilePair;
|
||||
if (appThread->GetHqfFileAndHapPath(bundleName, hqfFilePair)) {
|
||||
for (auto it = hqfFilePair.begin(); it != hqfFilePair.end(); it++) {
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "hqfFile: %{private}s, hapPath: %{private}s.",
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "hqfFile: %{private}s, hapPath: %{private}s",
|
||||
it->first.c_str(), it->second.c_str());
|
||||
ret = appThread->application_->NotifyLoadRepairPatch(it->first, it->second);
|
||||
}
|
||||
} else {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ScheduleNotifyLoadRepairPatch, There's no hqfFile need to load.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ScheduleNotifyLoadRepairPatch, There's no hqfFile need to load");
|
||||
}
|
||||
|
||||
callback->OnLoadPatchDone(ret ? NO_ERROR : ERR_INVALID_OPERATION, recordId);
|
||||
};
|
||||
if (mainHandler_ == nullptr || !mainHandler_->PostTask(task, "MainThread:NotifyLoadRepairPatch")) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ScheduleNotifyLoadRepairPatch, Post task failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ScheduleNotifyLoadRepairPatch, Post task failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@ -3005,14 +3002,14 @@ int32_t MainThread::ScheduleNotifyHotReloadPage(const sptr<IQuickFixCallback> &c
|
||||
auto task = [weak, callback, recordId]() {
|
||||
auto appThread = weak.promote();
|
||||
if (appThread == nullptr || appThread->application_ == nullptr || callback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "parameter is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "parameter is nullptr");
|
||||
return;
|
||||
}
|
||||
auto ret = appThread->application_->NotifyHotReloadPage();
|
||||
callback->OnReloadPageDone(ret ? NO_ERROR : ERR_INVALID_OPERATION, recordId);
|
||||
};
|
||||
if (mainHandler_ == nullptr || !mainHandler_->PostTask(task, "MainThread:NotifyHotReloadPage")) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Post task failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Post task failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@ -3025,7 +3022,7 @@ bool MainThread::GetHqfFileAndHapPath(const std::string &bundleName,
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
auto bundleMgrHelper = DelayedSingleton<BundleMgrHelper>::GetInstance();
|
||||
if (bundleMgrHelper == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleMgrHelper is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleMgrHelper is nullptr");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3038,7 +3035,7 @@ bool MainThread::GetHqfFileAndHapPath(const std::string &bundleName,
|
||||
static_cast<int32_t>(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_SIGNATURE_INFO) +
|
||||
static_cast<int32_t>(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY) +
|
||||
static_cast<int32_t>(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_METADATA)), bundleInfo) != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get bundle info of %{public}s failed.", bundleName.c_str());
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get bundle info of %{public}s failed", bundleName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3048,7 +3045,7 @@ bool MainThread::GetHqfFileAndHapPath(const std::string &bundleName,
|
||||
std::string resolvedHapPath(AbilityBase::GetLoadPath(hapInfo.hapPath));
|
||||
std::string resolvedHqfFile(AbilityBase::GetLoadPath(hapInfo.hqfInfo.hqfFilePath));
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "bundleName: %{public}s, moduleName: %{public}s, processName: %{private}s, "
|
||||
"hqf file: %{private}s, hap path: %{private}s.", bundleName.c_str(), hapInfo.moduleName.c_str(),
|
||||
"hqf file: %{private}s, hap path: %{private}s", bundleName.c_str(), hapInfo.moduleName.c_str(),
|
||||
hapInfo.process.c_str(), resolvedHqfFile.c_str(), resolvedHapPath.c_str());
|
||||
fileMap.push_back(std::pair<std::string, std::string>(resolvedHqfFile, resolvedHapPath));
|
||||
}
|
||||
@ -3066,7 +3063,7 @@ int32_t MainThread::ScheduleNotifyUnLoadRepairPatch(const std::string &bundleNam
|
||||
auto task = [weak, bundleName, callback, recordId]() {
|
||||
auto appThread = weak.promote();
|
||||
if (appThread == nullptr || appThread->application_ == nullptr || callback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, " parameter is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, " parameter is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3074,17 +3071,17 @@ int32_t MainThread::ScheduleNotifyUnLoadRepairPatch(const std::string &bundleNam
|
||||
std::vector<std::pair<std::string, std::string>> hqfFilePair;
|
||||
if (appThread->GetHqfFileAndHapPath(bundleName, hqfFilePair)) {
|
||||
for (auto it = hqfFilePair.begin(); it != hqfFilePair.end(); it++) {
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "hqfFile: %{private}s.", it->first.c_str());
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "hqfFile: %{private}s", it->first.c_str());
|
||||
ret = appThread->application_->NotifyUnLoadRepairPatch(it->first);
|
||||
}
|
||||
} else {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ScheduleNotifyUnLoadRepairPatch, There's no hqfFile need to unload.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ScheduleNotifyUnLoadRepairPatch, There's no hqfFile need to unload");
|
||||
}
|
||||
|
||||
callback->OnUnloadPatchDone(ret ? NO_ERROR : ERR_INVALID_OPERATION, recordId);
|
||||
};
|
||||
if (mainHandler_ == nullptr || !mainHandler_->PostTask(task, "MainThread:NotifyUnLoadRepairPatch")) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ScheduleNotifyUnLoadRepairPatch, Post task failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ScheduleNotifyUnLoadRepairPatch, Post task failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@ -3106,7 +3103,7 @@ int32_t MainThread::ScheduleNotifyAppFault(const FaultData &faultData)
|
||||
auto task = [weak, faultData] {
|
||||
auto appThread = weak.promote();
|
||||
if (appThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appThread is nullptr, NotifyAppFault failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appThread is nullptr, NotifyAppFault failed");
|
||||
return;
|
||||
}
|
||||
appThread->NotifyAppFault(faultData);
|
||||
@ -3170,26 +3167,26 @@ int MainThread::GetOverlayModuleInfos(const std::string &bundleName, const std::
|
||||
{
|
||||
auto bundleMgrHelper = DelayedSingleton<BundleMgrHelper>::GetInstance();
|
||||
if (bundleMgrHelper == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleMgrHelper is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleMgrHelper is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
auto overlayMgrProxy = bundleMgrHelper->GetOverlayManagerProxy();
|
||||
if (overlayMgrProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The overlayMgrProxy is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The overlayMgrProxy is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
auto ret = overlayMgrProxy->GetTargetOverlayModuleInfo(moduleName, overlayModuleInfos);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "failed");
|
||||
return ret;
|
||||
}
|
||||
std::sort(overlayModuleInfos.begin(), overlayModuleInfos.end(),
|
||||
[](const OverlayModuleInfo& lhs, const OverlayModuleInfo& rhs) -> bool {
|
||||
return lhs.priority > rhs.priority;
|
||||
});
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "the size of overlay is: %{public}zu.", overlayModuleInfos.size());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "the size of overlay is: %{public}zu", overlayModuleInfos.size());
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@ -3204,7 +3201,7 @@ std::vector<std::string> MainThread::GetAddOverlayPaths(const std::vector<Overla
|
||||
if ((iter != overlayModuleInfos_.end()) && (it.state == AppExecFwk::OverlayState::OVERLAY_ENABLE)) {
|
||||
iter->state = it.state;
|
||||
ChangeToLocalPath(iter->bundleName, iter->hapPath, iter->hapPath);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "add path:%{public}s.", iter->hapPath.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "add path:%{public}s", iter->hapPath.c_str());
|
||||
addPaths.emplace_back(iter->hapPath);
|
||||
}
|
||||
}
|
||||
@ -3222,7 +3219,7 @@ std::vector<std::string> MainThread::GetRemoveOverlayPaths(const std::vector<Ove
|
||||
if ((iter != overlayModuleInfos_.end()) && (it.state != AppExecFwk::OverlayState::OVERLAY_ENABLE)) {
|
||||
iter->state = it.state;
|
||||
ChangeToLocalPath(iter->bundleName, iter->hapPath, iter->hapPath);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "remove path:%{public}s.", iter->hapPath.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "remove path:%{public}s", iter->hapPath.c_str());
|
||||
removePaths.emplace_back(iter->hapPath);
|
||||
}
|
||||
}
|
||||
@ -3232,7 +3229,7 @@ std::vector<std::string> MainThread::GetRemoveOverlayPaths(const std::vector<Ove
|
||||
|
||||
int32_t MainThread::ScheduleChangeAppGcState(int32_t state)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called, state is %{public}d.", state);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called, state is %{public}d", state);
|
||||
if (mainHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "mainHandler is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
@ -3260,12 +3257,12 @@ int32_t MainThread::ChangeAppGcState(int32_t state)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (application_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "application_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "application_ is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
auto &runtime = application_->GetRuntime();
|
||||
if (runtime == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (runtime->GetLanguage() == AbilityRuntime::Runtime::Language::CJ) {
|
||||
@ -3301,7 +3298,7 @@ void MainThread::AssertFaultPauseMainThreadDetection()
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
SetAppDebug(AbilityRuntime::AppFreezeState::AppFreezeFlag::ASSERT_DEBUG_MODE, true);
|
||||
if (appMgr_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appMgr is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appMgr is nullptr");
|
||||
return;
|
||||
}
|
||||
appMgr_->SetAppAssertionPauseState(true);
|
||||
@ -3312,7 +3309,7 @@ void MainThread::AssertFaultResumeMainThreadDetection()
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
SetAppDebug(AbilityRuntime::AppFreezeState::AppFreezeFlag::ASSERT_DEBUG_MODE, false);
|
||||
if (appMgr_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appMgr is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appMgr is nullptr");
|
||||
return;
|
||||
}
|
||||
appMgr_->SetAppAssertionPauseState(false);
|
||||
@ -3321,20 +3318,20 @@ void MainThread::AssertFaultResumeMainThreadDetection()
|
||||
void MainThread::HandleInitAssertFaultTask(bool isDebugModule, bool isDebugApp)
|
||||
{
|
||||
if (!system::GetBoolParameter(PRODUCT_ASSERT_FAULT_DIALOG_ENABLED, false)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Unsupport assert fault dialog.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Unsupport assert fault dialog");
|
||||
return;
|
||||
}
|
||||
if (!system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Developer Mode is false.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Developer Mode is false");
|
||||
return;
|
||||
}
|
||||
if (!isDebugApp) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Non-debug version application.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Non-debug version application");
|
||||
return;
|
||||
}
|
||||
auto assertThread = DelayedSingleton<AbilityRuntime::AssertFaultTaskThread>::GetInstance();
|
||||
if (assertThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get assert thread instance is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get assert thread instance is nullptr");
|
||||
return;
|
||||
}
|
||||
assertThread->InitAssertFaultTask(this, isDebugModule);
|
||||
@ -3346,17 +3343,17 @@ void MainThread::SetAppDebug(uint32_t modeFlag, bool isDebug)
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
auto state = DelayedSingleton<AbilityRuntime::AppFreezeState>::GetInstance();
|
||||
if (state == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get app freeze state instance is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get app freeze state instance is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isDebug) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Call Cancel modeFlag is %{public}u.", modeFlag);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Call Cancel modeFlag is %{public}u", modeFlag);
|
||||
state->CancelAppFreezeState(modeFlag);
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Call Set modeFlag is %{public}u.", modeFlag);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Call Set modeFlag is %{public}u", modeFlag);
|
||||
state->SetAppFreezeState(modeFlag);
|
||||
}
|
||||
|
||||
@ -3364,7 +3361,7 @@ void MainThread::HandleCancelAssertFaultTask()
|
||||
{
|
||||
auto assertThread = assertThread_.lock();
|
||||
if (assertThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get assert thread instance is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Get assert thread instance is nullptr");
|
||||
return;
|
||||
}
|
||||
assertThread->Stop();
|
||||
@ -3379,21 +3376,21 @@ int32_t MainThread::ScheduleDumpIpcStart(std::string& result)
|
||||
|
||||
int32_t MainThread::ScheduleDumpIpcStop(std::string& result)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "MainThread::ScheduleDumpIpcStop::pid:%{public}d", getprocpid());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "pid:%{public}d", getprocpid());
|
||||
DumpIpcHelper::DumpIpcStop(result);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t MainThread::ScheduleDumpIpcStat(std::string& result)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "MainThread::ScheduleDumpIpcStat::pid:%{public}d", getprocpid());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "pid:%{public}d", getprocpid());
|
||||
DumpIpcHelper::DumpIpcStat(result);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t MainThread::ScheduleDumpFfrt(std::string& result)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "MainThread::ScheduleDumpFfrt::pid:%{public}d", getprocpid());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "pid:%{public}d", getprocpid());
|
||||
return DumpFfrtHelper::DumpFfrt(result);
|
||||
}
|
||||
|
||||
@ -3468,7 +3465,7 @@ void MainThread::ParseAppConfigurationParams(const std::string configuration, Co
|
||||
void MainThread::HandleCacheProcess()
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start");
|
||||
|
||||
// force gc
|
||||
if (application_ != nullptr) {
|
||||
|
@ -113,11 +113,10 @@ void OHOSApplication::OnBackground()
|
||||
}
|
||||
|
||||
if (runtime_ == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "NotifyApplicationState, runtime_ is nullptr");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "runtime_ is nullptr");
|
||||
return;
|
||||
}
|
||||
runtime_->NotifyApplicationState(true);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "NotifyApplicationState::OnBackground end");
|
||||
}
|
||||
|
||||
void OHOSApplication::DumpApplication()
|
||||
@ -155,7 +154,6 @@ void OHOSApplication::DumpApplication()
|
||||
}
|
||||
|
||||
// create and initialize applicationInfo
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "==============applicationInfo==============");
|
||||
std::shared_ptr<ApplicationInfo> applicationInfoPtr = GetApplicationInfo();
|
||||
if (applicationInfoPtr != nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "applicationInfo: name: %{public}s", applicationInfoPtr->name.c_str());
|
||||
@ -174,11 +172,10 @@ void OHOSApplication::SetRuntime(std::unique_ptr<AbilityRuntime::Runtime>&& runt
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "begin");
|
||||
if (runtime == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "OHOSApplication::SetRuntime failed, runtime is empty");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime is empty");
|
||||
return;
|
||||
}
|
||||
runtime_ = std::move(runtime);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "end");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -191,7 +188,7 @@ void OHOSApplication::SetApplicationContext(
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (abilityRuntimeContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "OHOSApplication::SetApplicationContext failed, context is empty");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is empty");
|
||||
return;
|
||||
}
|
||||
abilityRuntimeContext_ = abilityRuntimeContext;
|
||||
@ -225,7 +222,7 @@ void OHOSApplication::SetAbilityRecordMgr(const std::shared_ptr<AbilityRecordMgr
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (abilityRecordMgr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "ContextDeal::SetAbilityRecordMgr failed, abilityRecordMgr is nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityRecordMgr is nullptr");
|
||||
return;
|
||||
}
|
||||
abilityRecordMgr_ = abilityRecordMgr;
|
||||
@ -438,7 +435,6 @@ void OHOSApplication::UnregisterElementsCallbacks(const std::shared_ptr<Elements
|
||||
void OHOSApplication::OnConfigurationUpdated(Configuration config)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (!abilityRecordMgr_ || !configuration_) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "abilityRecordMgr_ or configuration_ is null");
|
||||
return;
|
||||
@ -557,6 +553,8 @@ void OHOSApplication::OnConfigurationUpdated(Configuration config)
|
||||
configuration_->RemoveItem(AAFwk::GlobalConfigurationKey::COLORMODE_IS_SET_BY_SA);
|
||||
configuration_->RemoveItem(AAFwk::GlobalConfigurationKey::COLORMODE_NEED_REMOVE_SET_BY_SA);
|
||||
}
|
||||
|
||||
abilityRuntimeContext_->SetConfiguration(configuration_);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -569,7 +567,6 @@ void OHOSApplication::OnFontUpdated(Configuration config)
|
||||
{
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
// Notify Window
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Update configuration for all window.");
|
||||
auto diffConfiguration = std::make_shared<AppExecFwk::Configuration>(config);
|
||||
Rosen::Window::UpdateConfigurationForAll(diffConfiguration);
|
||||
#endif
|
||||
@ -622,18 +619,14 @@ void OHOSApplication::OnMemoryLevel(int level)
|
||||
*
|
||||
*/
|
||||
void OHOSApplication::OnStart()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Will be called the application ends
|
||||
*/
|
||||
void OHOSApplication::OnTerminate()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -650,16 +643,15 @@ void OHOSApplication::OnAbilitySaveState(const PacMap &outState)
|
||||
void OHOSApplication::SetAppEnv(const std::vector<AppEnvironment>& appEnvironments)
|
||||
{
|
||||
if (!appEnvironments.size()) {
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "appEnvironments empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto &appEnvironment : appEnvironments) {
|
||||
if (setenv(appEnvironment.name.c_str(), appEnvironment.value.c_str(), APP_ENVIRONMENT_OVERWRITE)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appEnvironment: %{public}s set failed.", appEnvironment.name.c_str());
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "appEnvironment: %{public}s set failed", appEnvironment.name.c_str());
|
||||
return;
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "appEnvironment set successfully: %{public}s = %{public}s.",
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "appEnvironment set successfully: %{public}s = %{public}s",
|
||||
appEnvironment.name.c_str(), appEnvironment.value.c_str());
|
||||
}
|
||||
return;
|
||||
@ -777,7 +769,7 @@ void OHOSApplication::UpdateApplicationInfoInstalled(const AppExecFwk::Applicati
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
|
||||
if (abilityRuntimeContext_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityRuntimeContext_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityRuntimeContext_ is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -788,12 +780,12 @@ bool OHOSApplication::AddAbilityStage(const AppExecFwk::HapModuleInfo &hapModule
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (abilityRuntimeContext_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityRuntimeContext_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityRuntimeContext_ is nullptr");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (runtime_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime_ is nullptr");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -854,7 +846,7 @@ void OHOSApplication::CleanAbilityStage(const sptr<IRemoteObject> &token,
|
||||
|
||||
void OHOSApplication::DoCleanWorkAfterStageCleaned(const AbilityInfo &abilityInfo)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "language: %{public}s.", abilityInfo.srcLanguage.c_str());
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "language: %{public}s", abilityInfo.srcLanguage.c_str());
|
||||
if (runtime_) {
|
||||
runtime_->DoCleanWorkAfterStageCleaned();
|
||||
}
|
||||
@ -892,9 +884,9 @@ void OHOSApplication::ScheduleAcceptWant(const AAFwk::Want &want, const std::str
|
||||
void OHOSApplication::ScheduleNewProcessRequest(const AAFwk::Want &want, const std::string &moduleName,
|
||||
std::string &flag)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "call.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "call");
|
||||
if (abilityStages_.empty()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityStages_ is empty.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityStages_ is empty");
|
||||
return;
|
||||
}
|
||||
auto iter = abilityStages_.find(moduleName);
|
||||
@ -921,7 +913,7 @@ void OHOSApplication::SetExtensionTypeMap(std::map<int32_t, std::string> map)
|
||||
bool OHOSApplication::NotifyLoadRepairPatch(const std::string &hqfFile, const std::string &hapPath)
|
||||
{
|
||||
if (runtime_ == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "runtime is nullptr.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "runtime is nullptr");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -931,7 +923,7 @@ bool OHOSApplication::NotifyLoadRepairPatch(const std::string &hqfFile, const st
|
||||
bool OHOSApplication::NotifyHotReloadPage()
|
||||
{
|
||||
if (runtime_ == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "runtime is nullptr.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "runtime is nullptr");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -941,7 +933,7 @@ bool OHOSApplication::NotifyHotReloadPage()
|
||||
bool OHOSApplication::NotifyUnLoadRepairPatch(const std::string &hqfFile)
|
||||
{
|
||||
if (runtime_ == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "runtime is nullptr.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "runtime is nullptr");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -955,7 +947,7 @@ void OHOSApplication::CleanAppTempData(bool isLastProcess)
|
||||
return;
|
||||
}
|
||||
if (abilityRuntimeContext_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Context is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Context is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -969,7 +961,7 @@ void OHOSApplication::CleanAppTempData(bool isLastProcess)
|
||||
void OHOSApplication::CleanUselessTempData()
|
||||
{
|
||||
if (abilityRuntimeContext_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Context is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Context is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -984,7 +976,7 @@ void OHOSApplication::UpdateAppContextResMgr(const Configuration &config)
|
||||
{
|
||||
auto context = GetAppContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Application context is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Application context is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1010,7 +1002,7 @@ void OHOSApplication::CleanEmptyAbilityStage()
|
||||
}
|
||||
}
|
||||
if (containsNonEmpty) {
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "Application contains none empty abilityStage.");
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "Application contains none empty abilityStage");
|
||||
}
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
|
@ -28,7 +28,7 @@ OverlayEventSubscriber::OverlayEventSubscriber(const EventFwk::CommonEventSubscr
|
||||
|
||||
void OverlayEventSubscriber::OnReceiveEvent(const EventFwk::CommonEventData &data)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "OnReceiveEvent begin.");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "OnReceiveEvent begin");
|
||||
if (callback_ != nullptr) {
|
||||
callback_(data);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ sptr<IRemoteObject> SysMrgClient::GetSystemAbility(const int32_t systemAbilityId
|
||||
if (abilityManager_ == nullptr) {
|
||||
abilityManager_ = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (abilityManager_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "fail to GetSystemAbility abilityManager_ == nullptr.");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityManager_ == nullptr.");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ int AppfreezeInner::AppfreezeHandle(const FaultData& faultData, bool onlyMainThr
|
||||
bool AppfreezeInner::IsExitApp(const std::string& name)
|
||||
{
|
||||
if (name == AppFreezeType::THREAD_BLOCK_6S || name == AppFreezeType::APP_INPUT_BLOCK ||
|
||||
name == AppFreezeType::LIFECYCLE_TIMEOUT) {
|
||||
name == AppFreezeType::LIFECYCLE_TIMEOUT || name == AppFreezeType::BUSSINESS_THREAD_BLOCK_6S) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -128,7 +128,7 @@ void AppfreezeInner::SendProcessKillEvent(const std::string& killReason)
|
||||
std::string processName = applicationInfo->process;
|
||||
int result = HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::FRAMEWORK, "PROCESS_KILL",
|
||||
HiviewDFX::HiSysEvent::EventType::FAULT, EVENT_PID, pid,
|
||||
EVENT_PROCESS_NAME, applicationInfo->process, EVENT_MESSAGE, killReason);
|
||||
EVENT_PROCESS_NAME, processName, EVENT_MESSAGE, killReason);
|
||||
TAG_LOGI(AAFwkTag::APPDFR, "hisysevent write result=%{public}d, send event [FRAMEWORK,PROCESS_KILL],"
|
||||
" pid=%{public}d, processName=%{public}s, msg=%{public}s", result, pid, processName.c_str(),
|
||||
killReason.c_str());
|
||||
|
@ -26,6 +26,13 @@ ohos_shared_library("wantconstant_napi") {
|
||||
"hilog:libhilog",
|
||||
"napi:ace_napi",
|
||||
]
|
||||
|
||||
cflags_cc = []
|
||||
if (os_dlp_part_enabled) {
|
||||
cflags_cc += [ "-DWITH_DLP" ]
|
||||
external_deps += [ "dlp_permission_service:libdlp_permission_sdk" ]
|
||||
}
|
||||
|
||||
part_name = "ability_runtime"
|
||||
subsystem_name = "ability"
|
||||
}
|
||||
|
@ -104,6 +104,7 @@ ohos_shared_library("ability_manager") {
|
||||
"${ability_runtime_services_path}/abilitymgr/src/want_sender_proxy.cpp",
|
||||
"${ability_runtime_services_path}/abilitymgr/src/want_sender_stub.cpp",
|
||||
"${ability_runtime_services_path}/abilitymgr/src/wants_info.cpp",
|
||||
"${ability_runtime_services_path}/abilitymgr/src/window_config.cpp",
|
||||
"src/status_bar_delegate/status_bar_delegate_proxy.cpp",
|
||||
"src/status_bar_delegate/status_bar_delegate_stub.cpp",
|
||||
"src/window_manager_service_handler_proxy.cpp",
|
||||
@ -134,7 +135,6 @@ ohos_shared_library("ability_manager") {
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:base",
|
||||
"bundle_framework:libappexecfwk_common",
|
||||
"c_utils:utils",
|
||||
"common_event_service:cesfwk_innerkits",
|
||||
@ -151,6 +151,7 @@ ohos_shared_library("ability_manager") {
|
||||
}
|
||||
|
||||
public_external_deps = [
|
||||
"ability_base:base",
|
||||
"ability_base:configuration",
|
||||
"ability_base:session_info",
|
||||
"ability_base:want",
|
||||
|
@ -41,7 +41,6 @@ class AbilityManagerClient {
|
||||
public:
|
||||
virtual ~AbilityManagerClient();
|
||||
static std::shared_ptr<AbilityManagerClient> GetInstance();
|
||||
|
||||
void RemoveDeathRecipient();
|
||||
|
||||
/**
|
||||
@ -62,6 +61,14 @@ public:
|
||||
*/
|
||||
ErrCode AbilityTransitionDone(sptr<IRemoteObject> token, int state, const PacMap &saveData);
|
||||
|
||||
/**
|
||||
* AbilityWindowConfigTransitionDone, ability call this interface after lift cycle was changed.
|
||||
*
|
||||
* @param token,.ability's token.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode AbilityWindowConfigTransitionDone(sptr<IRemoteObject> token, const WindowConfig &windowConfig);
|
||||
|
||||
/**
|
||||
* ScheduleConnectAbilityDone, service ability call this interface while session was connected.
|
||||
*
|
||||
@ -1407,6 +1414,13 @@ public:
|
||||
int32_t UpdateSessionInfoBySCB(std::list<SessionInfo> &sessionInfos, int32_t userId,
|
||||
std::vector<int32_t> &sessionIds);
|
||||
|
||||
/**
|
||||
* @brief Restart app self.
|
||||
* @param want The ability type must be UIAbility.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t RestartApp(const AAFwk::Want &want);
|
||||
|
||||
/**
|
||||
* @brief Get host info of root caller.
|
||||
*
|
||||
@ -1429,13 +1443,6 @@ public:
|
||||
ErrCode GetUIExtensionSessionInfo(const sptr<IRemoteObject> token, UIExtensionSessionInfo &uiExtensionSessionInfo,
|
||||
int32_t userId = DEFAULT_INVAL_VALUE);
|
||||
|
||||
/**
|
||||
* @brief Restart app self.
|
||||
* @param want The ability type must be UIAbility.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t RestartApp(const AAFwk::Want &want);
|
||||
|
||||
/**
|
||||
* Pop-up launch of full-screen atomic service.
|
||||
*
|
||||
@ -1542,6 +1549,14 @@ public:
|
||||
*/
|
||||
int32_t OpenLink(const Want& want, sptr<IRemoteObject> callerToken, int32_t userId, int requestCode);
|
||||
|
||||
/**
|
||||
* Terminate process by bundleName.
|
||||
*
|
||||
* @param missionId, The mission id of the UIAbility need to be terminated.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode TerminateMission(int32_t missionId);
|
||||
|
||||
private:
|
||||
AbilityManagerClient();
|
||||
DISALLOW_COPY_AND_MOVE(AbilityManagerClient);
|
||||
@ -1557,9 +1572,7 @@ private:
|
||||
|
||||
sptr<IAbilityManager> GetAbilityManager();
|
||||
void ResetProxy(wptr<IRemoteObject> remote);
|
||||
#ifdef WITH_DLP
|
||||
void HandleDlpApp(Want &want);
|
||||
#endif // WITH_DLP
|
||||
|
||||
static std::once_flag singletonFlag_;
|
||||
std::recursive_mutex mutex_;
|
||||
|
@ -462,7 +462,7 @@ enum {
|
||||
* Native error(2097240) for memory size state unchanged.
|
||||
*/
|
||||
ERR_NATIVE_MEMORY_SIZE_STATE_UNCHANGED,
|
||||
|
||||
|
||||
/**
|
||||
* Native error(2097241) for target bundle not exist.
|
||||
*/
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include "want_sender_info.h"
|
||||
#include "want_sender_interface.h"
|
||||
#include "dialog_session_info.h"
|
||||
#include "window_config.h"
|
||||
#ifdef SUPPORT_SCREEN
|
||||
#include "window_manager_service_handler.h"
|
||||
#include "ability_first_frame_state_observer_interface.h"
|
||||
@ -645,6 +646,18 @@ public:
|
||||
*/
|
||||
virtual int AbilityTransitionDone(const sptr<IRemoteObject> &token, int state, const PacMap &saveData) = 0;
|
||||
|
||||
/**
|
||||
* AbilityWindowConfigTransitionDone, ability call this interface after life cycle was changed.
|
||||
*
|
||||
* @param token,.ability's token.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int AbilityWindowConfigTransitionDone(
|
||||
const sptr<IRemoteObject> &token, const WindowConfig &windowConfig)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ScheduleConnectAbilityDone, service ability call this interface while session was connected.
|
||||
*
|
||||
@ -1505,6 +1518,16 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Restart app self.
|
||||
* @param want The ability type must be UIAbility.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int32_t RestartApp(const AAFwk::Want &want)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get host info of root caller.
|
||||
*
|
||||
@ -1533,16 +1556,6 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Restart app self.
|
||||
* @param want The ability type must be UIAbility.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int32_t RestartApp(const AAFwk::Want &want)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open link of ability and atomic service.
|
||||
*
|
||||
@ -1680,6 +1693,17 @@ public:
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Terminate the mission.
|
||||
*
|
||||
* @param missionId, The mission id of the UIAbility need to be terminated.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int32_t TerminateMission(int32_t missionId)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
@ -244,6 +244,9 @@ enum class AbilityManagerInterfaceCode {
|
||||
// Set resident process enable status.
|
||||
SET_RESIDENT_PROCESS_ENABLE = 80,
|
||||
|
||||
// ipc id for ability window config transition done (81)
|
||||
ABILITY_WINDOW_CONFIG_TRANSITION_DONE = 81,
|
||||
|
||||
// ipc id 1001-2000 for DMS
|
||||
// ipc id for starting ability (1001)
|
||||
START_ABILITY = 1001,
|
||||
@ -377,7 +380,7 @@ enum class AbilityManagerInterfaceCode {
|
||||
// request modal UIExtension by want
|
||||
REQUESET_MODAL_UIEXTENSION = 1056,
|
||||
|
||||
// get root host info of uiextesnion
|
||||
// get root host info of uiextension
|
||||
GET_UI_EXTENSION_ROOT_HOST_INFO = 1057,
|
||||
|
||||
// change current ability visibility
|
||||
@ -543,6 +546,9 @@ enum class AbilityManagerInterfaceCode {
|
||||
REQUEST_ASSERT_FAULT_DIALOG = 6116,
|
||||
// ipc id for notify the operation status of the user
|
||||
NOTIFY_DEBUG_ASSERT_RESULT = 6117,
|
||||
|
||||
// ipc id for terminate mission
|
||||
TERMINATE_MISSION = 6118,
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
39
interfaces/inner_api/ability_manager/include/window_config.h
Normal file
39
interfaces/inner_api/ability_manager/include/window_config.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_ABILITY_RUNTIME_WINDOW_CONFIG_H
|
||||
#define OHOS_ABILITY_RUNTIME_WINDOW_CONFIG_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
struct WindowConfig : public Parcelable {
|
||||
WindowConfig() = default;
|
||||
|
||||
int32_t windowType = 0;
|
||||
int32_t posx = 0;
|
||||
int32_t posy = 0;
|
||||
uint32_t width = 0;
|
||||
uint32_t height = 0;
|
||||
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
static WindowConfig *Unmarshalling(Parcel &parcel);
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_ABILITY_RUNTIME_WINDOW_CONFIG_H
|
@ -76,7 +76,6 @@ ohos_shared_library("app_manager") {
|
||||
"src/appmgr/app_state_callback_host.cpp",
|
||||
"src/appmgr/app_state_callback_proxy.cpp",
|
||||
"src/appmgr/app_state_data.cpp",
|
||||
"src/appmgr/app_task_info.cpp",
|
||||
"src/appmgr/application_state_observer_proxy.cpp",
|
||||
"src/appmgr/application_state_observer_stub.cpp",
|
||||
"src/appmgr/child_process_args.cpp",
|
||||
|
@ -342,6 +342,15 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* whether the abilities of process specified by pid type only UIAbility.
|
||||
* @return Returns true is only UIAbility, otherwise return false
|
||||
*/
|
||||
virtual bool IsProcessContainsOnlyUIAbility(const pid_t pid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
enum class Message {
|
||||
LOAD_ABILITY = 0,
|
||||
TERMINATE_ABILITY,
|
||||
@ -384,11 +393,12 @@ public:
|
||||
KILL_PROCESSES_BY_PIDS,
|
||||
ATTACH_PID_TO_PARENT,
|
||||
IS_MEMORY_SIZE_SUFFICIENT,
|
||||
SET_KEEP_ALIVE_ENABLE_STATE,
|
||||
NOTIFY_APP_MGR_RECORD_EXIT_REASON,
|
||||
SET_KEEP_ALIVE_ENABLE_STATE,
|
||||
ATTACHED_TO_STATUS_BAR,
|
||||
BLOCK_PROCESS_CACHE_BY_PIDS,
|
||||
IS_KILLED_FOR_UPGRADE_WEB,
|
||||
IS_PROCESS_CONTAINS_ONLY_UI_EXTENSION,
|
||||
FORCE_KILL_APPLICATION,
|
||||
};
|
||||
};
|
||||
|
@ -309,6 +309,12 @@ public:
|
||||
*/
|
||||
virtual bool IsKilledForUpgradeWeb(const std::string &bundleName) override;
|
||||
|
||||
/**
|
||||
* whether the abilities of process specified by pid type only UIAbility.
|
||||
* @return Returns true is only UIAbility, otherwise return false
|
||||
*/
|
||||
virtual bool IsProcessContainsOnlyUIAbility(const pid_t pid) override;
|
||||
|
||||
private:
|
||||
bool WriteInterfaceToken(MessageParcel &data);
|
||||
int32_t SendTransactCmd(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
|
||||
|
@ -95,6 +95,7 @@ private:
|
||||
MessageParcel &reply, MessageOption &option);
|
||||
int32_t HandleBlockProcessCacheByPids(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleIsKilledForUpgradeWeb(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleIsProcessContainsOnlyUIAbility(MessageParcel &data, MessageParcel &reply);
|
||||
DISALLOW_COPY_AND_MOVE(AmsMgrStub);
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
|
@ -682,13 +682,6 @@ public:
|
||||
*/
|
||||
int32_t UnregisterAppRunningStatusListener(const sptr<IRemoteObject> &listener);
|
||||
|
||||
/**
|
||||
* Whether the current application process is the last surviving process.
|
||||
*
|
||||
* @return Returns true is final application process, others return false.
|
||||
*/
|
||||
bool IsFinalAppProcess();
|
||||
|
||||
/**
|
||||
* To clear the process by ability token.
|
||||
*
|
||||
@ -696,6 +689,13 @@ public:
|
||||
*/
|
||||
void ClearProcessByToken(sptr<IRemoteObject> token) const;
|
||||
|
||||
/**
|
||||
* Whether the current application process is the last surviving process.
|
||||
*
|
||||
* @return Returns true is final application process, others return false.
|
||||
*/
|
||||
bool IsFinalAppProcess();
|
||||
|
||||
int32_t RegisterRenderStateObserver(const sptr<IRenderStateObserver> &observer);
|
||||
|
||||
int32_t UnregisterRenderStateObserver(const sptr<IRenderStateObserver> &observer);
|
||||
@ -795,6 +795,12 @@ public:
|
||||
*/
|
||||
bool IsKilledForUpgradeWeb(const std::string &bundleName);
|
||||
|
||||
/**
|
||||
* whether the abilities of process specified by pid type only UIAbility.
|
||||
* @return Returns true is only UIAbility, otherwise return false
|
||||
*/
|
||||
bool IsProcessContainsOnlyUIAbility(const pid_t pid);
|
||||
|
||||
private:
|
||||
void SetServiceManager(std::unique_ptr<AppServiceManager> serviceMgr);
|
||||
/**
|
||||
|
@ -607,8 +607,6 @@ public:
|
||||
*/
|
||||
virtual int32_t NotifyMemorySizeStateChanged(bool isMemorySizeSufficent) override;
|
||||
|
||||
int32_t SetSupportedProcessCacheSelf(bool isSupport) override;
|
||||
|
||||
/**
|
||||
* Set application assertion pause state.
|
||||
*
|
||||
@ -616,15 +614,7 @@ public:
|
||||
*/
|
||||
void SetAppAssertionPauseState(bool flag) override;
|
||||
|
||||
/**
|
||||
* Start native child process, callde by ChildProcessManager.
|
||||
* @param libName lib file name to be load in child process
|
||||
* @param childProcessCount current started child process count
|
||||
* @param callback callback for notify start result
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t StartNativeChildProcess(const std::string &libName, int32_t childProcessCount,
|
||||
const sptr<IRemoteObject> &callback) override;
|
||||
int32_t SetSupportedProcessCacheSelf(bool isSupport) override;
|
||||
|
||||
virtual void SaveBrowserChannel(sptr<IRemoteObject> browser) override;
|
||||
|
||||
@ -636,6 +626,16 @@ public:
|
||||
*/
|
||||
int32_t CheckCallingIsUserTestMode(const pid_t pid, bool &isUserTest) override;
|
||||
|
||||
/**
|
||||
* Start native child process, callde by ChildProcessManager.
|
||||
* @param libName lib file name to be load in child process
|
||||
* @param childProcessCount current started child process count
|
||||
* @param callback callback for notify start result
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t StartNativeChildProcess(const std::string &libName, int32_t childProcessCount,
|
||||
const sptr<IRemoteObject> &callback) override;
|
||||
|
||||
virtual int32_t NotifyProcessDependedOnWeb() override;
|
||||
|
||||
virtual void KillProcessDependedOnWeb() override;
|
||||
|
@ -128,8 +128,8 @@ private:
|
||||
int32_t HandleGetChildProcessInfoForSelf(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleAttachChildProcess(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleExitChildProcessSafely(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleClearUpApplicationDataBySelf(MessageParcel& data, MessageParcel& reply);
|
||||
int32_t HandleIsFinalAppProcess(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleClearUpApplicationDataBySelf(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleRegisterRenderStateObserver(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleUnregisterRenderStateObserver(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleUpdateRenderState(MessageParcel &data, MessageParcel &reply);
|
||||
@ -138,11 +138,11 @@ private:
|
||||
int32_t HandleGetAllUIExtensionRootHostPid(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleGetAllUIExtensionProviderPid(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleNotifyMemorySizeStateChanged(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleSetAppAssertionPauseState(MessageParcel& data, MessageParcel& reply);
|
||||
int32_t HandleSetSupportedProcessCacheSelf(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleSetAppAssertionPauseState(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleStartNativeChildProcess(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleSaveBrowserChannel(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleCheckCallingIsUserTestMode(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleStartNativeChildProcess(MessageParcel& data, MessageParcel& reply);
|
||||
int32_t HandleNotifyProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleKillProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleRestartResidentProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply);
|
||||
|
@ -1,114 +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.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_ABILITY_RUNTIME_APP_TASK_INFO_H
|
||||
#define OHOS_ABILITY_RUNTIME_APP_TASK_INFO_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string>
|
||||
|
||||
#include "parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
class AppTaskInfo : public Parcelable {
|
||||
public:
|
||||
/**
|
||||
* @brief Obtains the app name.
|
||||
*
|
||||
* @return Returns the app name.
|
||||
*/
|
||||
const std::string &GetName() const;
|
||||
|
||||
/**
|
||||
* @brief Obtains the process name.
|
||||
*
|
||||
* @return Returns the process name.
|
||||
*/
|
||||
const std::string &GetProcessName() const;
|
||||
|
||||
/**
|
||||
* @brief Obtains the app pid.
|
||||
*
|
||||
* @return Returns the app pid.
|
||||
*/
|
||||
pid_t GetPid() const;
|
||||
|
||||
/**
|
||||
* @brief Obtains the app record id.
|
||||
*
|
||||
* @return Returns app record id.
|
||||
*/
|
||||
int32_t GetRecordId() const;
|
||||
|
||||
/**
|
||||
* @brief Setting name for app.
|
||||
*
|
||||
* @param appName, the app name.
|
||||
*/
|
||||
void SetName(const std::string &appName);
|
||||
|
||||
/**
|
||||
* @brief Setting name for process.
|
||||
*
|
||||
* @param int32_t, the process name.
|
||||
*/
|
||||
void SetProcessName(const std::string &processName);
|
||||
|
||||
/**
|
||||
* @brief Setting pid for app.
|
||||
*
|
||||
* @param int32_t, the app pid.
|
||||
*/
|
||||
void SetPid(const pid_t pid);
|
||||
|
||||
/**
|
||||
* @brief Setting id for app record.
|
||||
*
|
||||
* @param int32_t, the app record id.
|
||||
*/
|
||||
void SetRecordId(const int32_t appRecordId);
|
||||
|
||||
/**
|
||||
* @brief read this Sequenceable object from a Parcel.
|
||||
*
|
||||
* @param inParcel Indicates the Parcel object into which the Sequenceable object has been marshaled.
|
||||
* @return Returns true if read succeeded; returns false otherwise.
|
||||
*/
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
|
||||
/**
|
||||
* @brief Marshals this Sequenceable object into a Parcel.
|
||||
*
|
||||
* @param outParcel Indicates the Parcel object to which the Sequenceable object will be marshaled.
|
||||
*/
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
|
||||
/**
|
||||
* @brief Unmarshals this Sequenceable object from a Parcel.
|
||||
*
|
||||
* @param inParcel Indicates the Parcel object into which the Sequenceable object has been marshaled.
|
||||
*/
|
||||
static AppTaskInfo *Unmarshalling(Parcel &parcel);
|
||||
|
||||
private:
|
||||
std::string appName_;
|
||||
std::string processName_;
|
||||
pid_t pid_ = 0;
|
||||
int32_t appRecordId_ = 0;
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_ABILITY_RUNTIME_APP_TASK_INFO_H
|
@ -47,6 +47,8 @@ public:
|
||||
static constexpr char THREAD_BLOCK_3S[] = "THREAD_BLOCK_3S";
|
||||
static constexpr char THREAD_BLOCK_6S[] = "THREAD_BLOCK_6S";
|
||||
static constexpr char APP_INPUT_BLOCK[] = "APP_INPUT_BLOCK";
|
||||
static constexpr char BUSSINESS_THREAD_BLOCK_3S[] = "BUSSINESS_THREAD_BLOCK_3S";
|
||||
static constexpr char BUSSINESS_THREAD_BLOCK_6S[] = "BUSSINESS_THREAD_BLOCK_6S";
|
||||
};
|
||||
/**
|
||||
* @struct FaultData
|
||||
|
@ -29,6 +29,27 @@ constexpr int32_t MAX_APP_DEBUG_COUNT = 100;
|
||||
AmsMgrProxy::AmsMgrProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IAmsMgr>(impl)
|
||||
{}
|
||||
|
||||
bool AmsMgrProxy::IsProcessContainsOnlyUIAbility(const pid_t pid)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "IsProcessContainsOnlyUIAbility start");
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return false;
|
||||
}
|
||||
data.WriteInt32(static_cast<int32_t>(pid));
|
||||
int32_t ret =
|
||||
SendTransactCmd(static_cast<uint32_t>(
|
||||
IAmsMgr::Message::IS_PROCESS_CONTAINS_ONLY_UI_EXTENSION), data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret);
|
||||
return false;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "IsProcessContainsOnlyUIAbility end");
|
||||
return reply.ReadBool();
|
||||
}
|
||||
|
||||
bool AmsMgrProxy::WriteInterfaceToken(MessageParcel &data)
|
||||
{
|
||||
if (!data.WriteInterfaceToken(AmsMgrProxy::GetDescriptor())) {
|
||||
|
@ -190,6 +190,8 @@ int32_t AmsMgrStub::OnRemoteRequestInnerThird(uint32_t code, MessageParcel &data
|
||||
return HandleBlockProcessCacheByPids(data, reply);
|
||||
case static_cast<uint32_t>(IAmsMgr::Message::IS_KILLED_FOR_UPGRADE_WEB):
|
||||
return HandleIsKilledForUpgradeWeb(data, reply);
|
||||
case static_cast<uint32_t>(IAmsMgr::Message::IS_PROCESS_CONTAINS_ONLY_UI_EXTENSION):
|
||||
return HandleIsProcessContainsOnlyUIAbility(data, reply);
|
||||
case static_cast<uint32_t>(IAmsMgr::Message::FORCE_KILL_APPLICATION):
|
||||
return HandleForceKillApplication(data, reply);
|
||||
}
|
||||
@ -783,5 +785,17 @@ int32_t AmsMgrStub::HandleIsKilledForUpgradeWeb(MessageParcel &data, MessageParc
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t AmsMgrStub::HandleIsProcessContainsOnlyUIAbility(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
auto pid = data.ReadUint32();
|
||||
|
||||
auto result = IsProcessContainsOnlyUIAbility(pid);
|
||||
if (!reply.WriteBool(result)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Fail to write result in HandleIsProcessContainsOnlyUIAbility.");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
@ -490,6 +490,18 @@ AppMgrResultCode AppMgrClient::ConnectAppMgrService()
|
||||
return AppMgrResultCode::ERROR_SERVICE_NOT_READY;
|
||||
}
|
||||
|
||||
bool AppMgrClient::IsProcessContainsOnlyUIAbility(const pid_t pid)
|
||||
{
|
||||
sptr<IAppMgr> service = iface_cast<IAppMgr>(mgrHolder_->GetRemoteObject());
|
||||
if (service != nullptr) {
|
||||
sptr<IAmsMgr> amsService = service->GetAmsMgr();
|
||||
if (amsService != nullptr) {
|
||||
return amsService->IsProcessContainsOnlyUIAbility(pid);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void AppMgrClient::SetServiceManager(std::unique_ptr<AppServiceManager> serviceMgr)
|
||||
{
|
||||
if (!mgrHolder_) {
|
||||
|
@ -28,7 +28,6 @@ AppSchedulerHost::AppSchedulerHost()
|
||||
InitMemberFuncMap();
|
||||
}
|
||||
|
||||
|
||||
void AppSchedulerHost::InitMemberFuncMap() {}
|
||||
|
||||
AppSchedulerHost::~AppSchedulerHost()
|
||||
@ -480,6 +479,13 @@ int32_t AppSchedulerHost::HandleScheduleDumpIpcStat(MessageParcel &data, Message
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t AppSchedulerHost::HandleScheduleCacheProcess(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
HITRACE_METER(HITRACE_TAG_APP);
|
||||
ScheduleCacheProcess();
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t AppSchedulerHost::HandleScheduleDumpFfrt(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
HITRACE_METER(HITRACE_TAG_APP);
|
||||
@ -491,12 +497,5 @@ int32_t AppSchedulerHost::HandleScheduleDumpFfrt(MessageParcel &data, MessagePar
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t AppSchedulerHost::HandleScheduleCacheProcess(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
HITRACE_METER(HITRACE_TAG_APP);
|
||||
ScheduleCacheProcess();
|
||||
return NO_ERROR;
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2024 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 "app_task_info.h"
|
||||
|
||||
#include "hilog_tag_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
const std::string &AppTaskInfo::GetName() const
|
||||
{
|
||||
return appName_;
|
||||
}
|
||||
|
||||
const std::string &AppTaskInfo::GetProcessName() const
|
||||
{
|
||||
return processName_;
|
||||
}
|
||||
|
||||
pid_t AppTaskInfo::GetPid() const
|
||||
{
|
||||
return pid_;
|
||||
}
|
||||
|
||||
int32_t AppTaskInfo::GetRecordId() const
|
||||
{
|
||||
return appRecordId_;
|
||||
}
|
||||
|
||||
void AppTaskInfo::SetName(const std::string &appName)
|
||||
{
|
||||
appName_ = appName;
|
||||
}
|
||||
|
||||
void AppTaskInfo::SetProcessName(const std::string &processName)
|
||||
{
|
||||
processName_ = processName;
|
||||
}
|
||||
|
||||
void AppTaskInfo::SetPid(const pid_t pid)
|
||||
{
|
||||
pid_ = pid;
|
||||
}
|
||||
|
||||
void AppTaskInfo::SetRecordId(const int32_t appRecordId)
|
||||
{
|
||||
appRecordId_ = appRecordId;
|
||||
}
|
||||
|
||||
bool AppTaskInfo::Marshalling(Parcel &parcel) const
|
||||
{
|
||||
return (parcel.WriteString(appName_) && parcel.WriteString(processName_) && parcel.WriteInt32(pid_) &&
|
||||
parcel.WriteInt32(appRecordId_));
|
||||
}
|
||||
|
||||
bool AppTaskInfo::ReadFromParcel(Parcel &parcel)
|
||||
{
|
||||
return (parcel.ReadString(appName_) && parcel.ReadString(processName_) && parcel.ReadInt32(pid_) &&
|
||||
parcel.ReadInt32(appRecordId_));
|
||||
}
|
||||
|
||||
AppTaskInfo *AppTaskInfo::Unmarshalling(Parcel &parcel)
|
||||
{
|
||||
AppTaskInfo *appTaskInfo = new (std::nothrow) AppTaskInfo();
|
||||
if (appTaskInfo && !appTaskInfo->ReadFromParcel(parcel)) {
|
||||
TAG_LOGW(AAFwkTag::APPMGR, "failed, because ReadFromParcel failed");
|
||||
delete appTaskInfo;
|
||||
appTaskInfo = nullptr;
|
||||
}
|
||||
return appTaskInfo;
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
@ -19,6 +19,8 @@
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "view_data.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
namespace AutoFill {
|
||||
@ -80,6 +82,34 @@ struct AutoFillCustomConfig {
|
||||
std::optional<int32_t> maskColor;
|
||||
std::function<void(const std::string&)> onStateChange;
|
||||
};
|
||||
|
||||
enum class AutoFillCommand {
|
||||
NONE,
|
||||
FILL,
|
||||
SAVE,
|
||||
UPDATE,
|
||||
RESIZE,
|
||||
INPUT,
|
||||
RELOAD_IN_MODAL
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct AutoFillRequest
|
||||
* AutoFillRequest is used to define the auto fill request parameter structure.
|
||||
*/
|
||||
struct AutoFillRequest {
|
||||
AbilityBase::AutoFillType autoFillType = AbilityBase::AutoFillType::UNSPECIFIED;
|
||||
AutoFillCommand autoFillCommand = AutoFillCommand::NONE;
|
||||
AbilityBase::ViewData viewData;
|
||||
AutoFillCustomConfig config;
|
||||
std::function<void()> doAfterAsyncModalBinding;
|
||||
std::function<void()> onUIExtensionProxyReady;
|
||||
};
|
||||
|
||||
struct AutoFillResult {
|
||||
bool isPopup = false;
|
||||
uint32_t autoFillSessionId = 0;
|
||||
};
|
||||
} // AutoFill
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
@ -56,9 +56,7 @@ public:
|
||||
void SetWindowType(const AutoFill::AutoFillWindowType &autoFillWindowType);
|
||||
AutoFill::AutoFillWindowType GetWindowType() const;
|
||||
void SetExtensionType(bool isSmartAutoFill);
|
||||
void SetAutoFillType(const AbilityBase::AutoFillType &autoFillType);
|
||||
void SetViewData(const AbilityBase::ViewData &viewData);
|
||||
void SetAutoFillRequestConfig(const AutoFill::AutoFillCustomConfig &config);
|
||||
void SetAutoFillRequest(const AutoFill::AutoFillRequest &request);
|
||||
uint32_t GetCallbackId() const;
|
||||
void HandleTimeOut();
|
||||
void UpdateCustomPopupUIExtension(const AbilityBase::ViewData &viewData);
|
||||
@ -82,14 +80,12 @@ private:
|
||||
std::atomic<int32_t> instanceId_ {-1};
|
||||
uint32_t callbackId_ = 0;
|
||||
AutoFill::AutoFillWindowType autoFillWindowType_ = AutoFill::AutoFillWindowType::MODAL_WINDOW;
|
||||
AbilityBase::ViewData viewData_;
|
||||
AutoFill::AutoFillCustomConfig autoFillCustomConfig_;
|
||||
AutoFill::AutoFillRequest request_;
|
||||
bool isReloadInModal_ = false;
|
||||
bool isSmartAutoFill_ = false;
|
||||
bool isOnResult_ = false;
|
||||
AAFwk::Want want_;
|
||||
int32_t errCode_ = 0;
|
||||
AbilityBase::AutoFillType autoFillType_ = AbilityBase::AutoFillType::UNSPECIFIED;
|
||||
std::mutex proxyMutex_;
|
||||
std::shared_ptr<Ace::ModalUIExtensionProxy> modalUIExtensionProxy_;
|
||||
std::mutex closeMutex_;
|
||||
|
@ -28,38 +28,9 @@
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
#include "ui_content.h"
|
||||
#endif // SUPPORT_GRAPHICS
|
||||
#include "view_data.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
namespace AutoFill {
|
||||
enum class AutoFillCommand {
|
||||
NONE,
|
||||
FILL,
|
||||
SAVE,
|
||||
UPDATE,
|
||||
RESIZE,
|
||||
INPUT,
|
||||
RELOAD_IN_MODAL
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct AutoFillRequest
|
||||
* AutoFillRequest is used to define the auto fill request parameter structure.
|
||||
*/
|
||||
struct AutoFillRequest {
|
||||
AbilityBase::AutoFillType autoFillType = AbilityBase::AutoFillType::UNSPECIFIED;
|
||||
AutoFillCommand autoFillCommand = AutoFillCommand::NONE;
|
||||
AbilityBase::ViewData viewData;
|
||||
AutoFillCustomConfig config;
|
||||
std::function<void()> doAfterAsyncModalBinding;
|
||||
};
|
||||
|
||||
struct AutoFillResult {
|
||||
bool isPopup = false;
|
||||
uint32_t autoFillSessionId = 0;
|
||||
};
|
||||
}
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
class AutoFillManager {
|
||||
public:
|
||||
|
@ -28,7 +28,7 @@ namespace {
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
constexpr const char* WANT_PARAMS_VIEW_DATA_KEY = "ohos.ability.params.viewData";
|
||||
constexpr const char* WANT_PARAMS_AUTO_FILL_CMD_KEY = "ohos.ability.params.autoFillCmd";
|
||||
constexpr const char* WANT_PARAMS_FILL_CONTENT = "ohos.ability.params.fillContent";
|
||||
constexpr const char* WANT_PARAMS_FILL_CONTENT = "ohos.ability.params.fillContent";
|
||||
constexpr const char* WANT_PARAMS_CUSTOM_DATA_KEY = "ohos.ability.params.customData";
|
||||
constexpr const char* WANT_PARAMS_AUTO_FILL_EVENT_KEY = "ability.want.params.AutoFillEvent";
|
||||
constexpr const char* WANT_PARAMS_UPDATE_POPUP_WIDTH = "ohos.ability.params.popupWidth";
|
||||
@ -132,8 +132,8 @@ int32_t AutoFillExtensionCallback::ReloadInModal(const AAFwk::WantParams &wantPa
|
||||
want.SetParam(WANT_PARAMS_CUSTOM_DATA_KEY, wantParams.GetStringParam(WANT_PARAMS_CUSTOM_DATA_KEY));
|
||||
isSmartAutoFill_ ? want.SetParam(WANT_PARAMS_EXTENSION_TYPE_KEY, std::string(WANT_PARAMS_SMART_EXTENSION_TYPE)) :
|
||||
want.SetParam(WANT_PARAMS_EXTENSION_TYPE_KEY, std::string(WANT_PARAMS_EXTENSION_TYPE));
|
||||
want.SetParam(WANT_PARAMS_AUTO_FILL_TYPE_KEY, static_cast<int32_t>(autoFillType_));
|
||||
want.SetParam(WANT_PARAMS_VIEW_DATA_KEY, viewData_.ToJsonString());
|
||||
want.SetParam(WANT_PARAMS_AUTO_FILL_TYPE_KEY, static_cast<int32_t>(request_.autoFillType));
|
||||
want.SetParam(WANT_PARAMS_VIEW_DATA_KEY, request_.viewData.ToJsonString());
|
||||
want.SetParam(WANT_PARAMS_AUTO_FILL_POPUP_WINDOW_KEY, false);
|
||||
Ace::ModalUIExtensionCallbacks callback;
|
||||
AutoFillManager::GetInstance().BindModalUIExtensionCallback(shared_from_this(), callback);
|
||||
@ -169,7 +169,7 @@ void AutoFillExtensionCallback::OnReceive(const AAFwk::WantParams &wantParams)
|
||||
void AutoFillExtensionCallback::UpdateCustomPopupConfig(const AAFwk::WantParams &wantParams)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "called");
|
||||
AutoFill::AutoFillCustomConfig autoFillCustomConfig = autoFillCustomConfig_;
|
||||
AutoFill::AutoFillCustomConfig autoFillCustomConfig = request_.config;
|
||||
if (wantParams.HasParam(WANT_PARAMS_UPDATE_POPUP_WIDTH) &&
|
||||
wantParams.HasParam(WANT_PARAMS_UPDATE_POPUP_HEIGHT)) {
|
||||
AutoFill::PopupSize popupSize;
|
||||
@ -205,6 +205,9 @@ void AutoFillExtensionCallback::onRemoteReady(const std::shared_ptr<Ace::ModalUI
|
||||
return;
|
||||
}
|
||||
SetModalUIExtensionProxy(modalUIExtensionProxy);
|
||||
if (request_.onUIExtensionProxyReady) {
|
||||
request_.onUIExtensionProxyReady();
|
||||
}
|
||||
}
|
||||
|
||||
void AutoFillExtensionCallback::onDestroy()
|
||||
@ -271,14 +274,9 @@ AutoFill::AutoFillWindowType AutoFillExtensionCallback::GetWindowType() const
|
||||
return autoFillWindowType_;
|
||||
}
|
||||
|
||||
void AutoFillExtensionCallback::SetViewData(const AbilityBase::ViewData &viewData)
|
||||
void AutoFillExtensionCallback::SetAutoFillRequest(const AutoFill::AutoFillRequest &request)
|
||||
{
|
||||
viewData_ = viewData;
|
||||
}
|
||||
|
||||
void AutoFillExtensionCallback::SetAutoFillRequestConfig(const AutoFill::AutoFillCustomConfig &config)
|
||||
{
|
||||
autoFillCustomConfig_ = config;
|
||||
request_ = request;
|
||||
}
|
||||
|
||||
void AutoFillExtensionCallback::SetExtensionType(bool isSmartAutoFill)
|
||||
@ -286,11 +284,6 @@ void AutoFillExtensionCallback::SetExtensionType(bool isSmartAutoFill)
|
||||
isSmartAutoFill_ = isSmartAutoFill;
|
||||
}
|
||||
|
||||
void AutoFillExtensionCallback::SetAutoFillType(const AbilityBase::AutoFillType &autoFillType)
|
||||
{
|
||||
autoFillType_ = autoFillType;
|
||||
}
|
||||
|
||||
void AutoFillExtensionCallback::HandleTimeOut()
|
||||
{
|
||||
CloseUIExtension();
|
||||
|
@ -125,11 +125,9 @@ int32_t AutoFillManager::HandleRequestExecuteInner(Ace::UIContent *uiContent, co
|
||||
result.autoFillSessionId = callbackId;
|
||||
extensionCallback->SetInstanceId(uiContent->GetInstanceId());
|
||||
extensionCallback->SetSessionId(sessionId);
|
||||
extensionCallback->SetViewData(request.viewData);
|
||||
extensionCallback->SetWindowType(autoFillWindowType);
|
||||
extensionCallback->SetExtensionType(isSmartAutoFill);
|
||||
extensionCallback->SetAutoFillType(request.autoFillType);
|
||||
extensionCallback->SetAutoFillRequestConfig(request.config);
|
||||
extensionCallback->SetAutoFillRequest(request);
|
||||
TAG_LOGI(AAFwkTag::AUTOFILLMGR, "callbackId: %{public}u.", callbackId);
|
||||
std::lock_guard<std::mutex> lock(extensionCallbacksMutex_);
|
||||
extensionCallbacks_.emplace(callbackId, extensionCallback);
|
||||
|
@ -54,6 +54,13 @@ ohos_shared_library("connection_obs_manager") {
|
||||
"ipc:ipc_core",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
|
||||
cflags_cc = []
|
||||
if (os_dlp_part_enabled) {
|
||||
cflags_cc += [ "-DWITH_DLP" ]
|
||||
external_deps += [ "dlp_permission_service:libdlp_permission_sdk" ]
|
||||
}
|
||||
|
||||
public_external_deps = [ "bundle_framework:appexecfwk_base" ]
|
||||
innerapi_tags = [ "platformsdk" ]
|
||||
subsystem_name = "ability"
|
||||
|
@ -41,6 +41,7 @@ ohos_shared_library("ability_deps_wrapper") {
|
||||
configs = [ ":ability_deps_wrapper_private_config" ]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:base",
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
"samgr:samgr_proxy",
|
||||
|
@ -76,6 +76,7 @@ ohos_shared_library("wantagent_innerkits") {
|
||||
external_deps = [
|
||||
"ability_base:want",
|
||||
"c_utils:utils",
|
||||
"hicollie:libhicollie",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
"ipc:ipc_core",
|
||||
|
@ -24,10 +24,14 @@
|
||||
#include "if_system_ability_manager.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "system_ability_definition.h"
|
||||
#include "xcollie/xcollie.h"
|
||||
#include "xcollie/xcollie_define.h"
|
||||
|
||||
using namespace OHOS::AbilityRuntime;
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
const unsigned int XCOLLIE_TIMEOUT = 10;
|
||||
|
||||
WantAgentClient &WantAgentClient::GetInstance()
|
||||
{
|
||||
static WantAgentClient client;
|
||||
@ -148,6 +152,12 @@ ErrCode WantAgentClient::GetPendingWantUserId(const sptr<IWantSender> &target, i
|
||||
|
||||
ErrCode WantAgentClient::GetPendingWantBundleName(const sptr<IWantSender> &target, std::string &bundleName)
|
||||
{
|
||||
int id = HiviewDFX::XCollie::GetInstance().SetTimer(
|
||||
"OHOS::AAFwk::WantAgentClient::GetPendingWantBundleName",
|
||||
XCOLLIE_TIMEOUT,
|
||||
nullptr,
|
||||
nullptr,
|
||||
HiviewDFX::XCOLLIE_FLAG_LOG | HiviewDFX::XCOLLIE_FLAG_RECOVERY);
|
||||
CHECK_POINTER_AND_RETURN(target, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_WANTAGENT);
|
||||
auto abms = GetAbilityManager();
|
||||
CHECK_POINTER_AND_RETURN(abms, ERR_ABILITY_RUNTIME_EXTERNAL_SERVICE_BUSY);
|
||||
@ -158,6 +168,7 @@ ErrCode WantAgentClient::GetPendingWantBundleName(const sptr<IWantSender> &targe
|
||||
return error;
|
||||
}
|
||||
bundleName = Str16ToStr8(reply.ReadString16());
|
||||
HiviewDFX::XCollie::GetInstance().CancelTimer(id);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@ -178,6 +189,12 @@ ErrCode WantAgentClient::GetPendingWantCode(const sptr<IWantSender> &target, int
|
||||
|
||||
ErrCode WantAgentClient::GetPendingWantType(sptr<IWantSender> target, int32_t &type)
|
||||
{
|
||||
int id = HiviewDFX::XCollie::GetInstance().SetTimer(
|
||||
"OHOS::AAFwk::WantAgentClient::GetPendingWantType",
|
||||
XCOLLIE_TIMEOUT,
|
||||
nullptr,
|
||||
nullptr,
|
||||
HiviewDFX::XCOLLIE_FLAG_LOG|HiviewDFX::XCOLLIE_FLAG_RECOVERY);
|
||||
CHECK_POINTER_AND_RETURN(target, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_WANTAGENT);
|
||||
auto abms = GetAbilityManager();
|
||||
CHECK_POINTER_AND_RETURN(abms, ERR_ABILITY_RUNTIME_EXTERNAL_SERVICE_BUSY);
|
||||
@ -189,6 +206,7 @@ ErrCode WantAgentClient::GetPendingWantType(sptr<IWantSender> target, int32_t &t
|
||||
}
|
||||
type = reply.ReadInt32();
|
||||
type < 0 ? type = 0 : type;
|
||||
HiviewDFX::XCollie::GetInstance().CancelTimer(id);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,16 @@
|
||||
#include "want_agent_log_wrapper.h"
|
||||
#include "want_sender_info.h"
|
||||
#include "want_sender_interface.h"
|
||||
#include "xcollie/xcollie.h"
|
||||
#include "xcollie/xcollie_define.h"
|
||||
|
||||
using namespace OHOS::AAFwk;
|
||||
using namespace OHOS::AppExecFwk;
|
||||
using namespace OHOS::AbilityRuntime;
|
||||
namespace OHOS::AbilityRuntime::WantAgent {
|
||||
|
||||
const unsigned int XCOLLIE_TIMEOUT = 10;
|
||||
|
||||
WantAgentHelper::WantAgentHelper()
|
||||
{}
|
||||
|
||||
@ -464,11 +469,18 @@ ErrCode WantAgentHelper::GetType(const std::shared_ptr<WantAgent> &agent, int32_
|
||||
|
||||
ErrCode WantAgentHelper::GetWant(const std::shared_ptr<WantAgent> &agent, std::shared_ptr<AAFwk::Want> &want)
|
||||
{
|
||||
int id = HiviewDFX::XCollie::GetInstance().SetTimer(
|
||||
"OHOS::AbilityRuntime::WantAgent::WantAgentHelper::GetWant",
|
||||
XCOLLIE_TIMEOUT,
|
||||
nullptr,
|
||||
nullptr,
|
||||
HiviewDFX::XCOLLIE_FLAG_LOG|HiviewDFX::XCOLLIE_FLAG_RECOVERY);
|
||||
if ((agent == nullptr) || (agent->GetPendingWant() == nullptr)) {
|
||||
TAG_LOGE(AAFwkTag::WANTAGENT, "invalid input param");
|
||||
return ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_WANTAGENT;
|
||||
}
|
||||
|
||||
return agent->GetPendingWant()->GetWant(agent->GetPendingWant()->GetTarget(), want);
|
||||
ErrCode result = agent->GetPendingWant()->GetWant(agent->GetPendingWant()->GetTarget(), want);
|
||||
HiviewDFX::XCollie::GetInstance().CancelTimer(id);
|
||||
return result;
|
||||
}
|
||||
} // namespace OHOS::AbilityRuntime::WantAgent
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user