mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 22:21:36 -04:00
Signed-off-by: m00512953 <mingxihua@huawei.com>
This commit is contained in:
@@ -346,8 +346,7 @@ void ContextImpl::InitResourceManager(const AppExecFwk::BundleInfo &bundleInfo,
|
||||
return;
|
||||
}
|
||||
|
||||
HILOG_DEBUG(
|
||||
"ContextImpl::InitResourceManager moduleResPaths count: %{public}zu", bundleInfo.moduleResPaths.size());
|
||||
HILOG_DEBUG("ContextImpl::InitResourceManager moduleResPaths count: %{public}zu", bundleInfo.moduleResPaths.size());
|
||||
std::vector<std::string> moduleResPaths;
|
||||
std::string inner(std::string(ABS_CODE_PATH) + std::string(FILE_SEPARATOR) + GetBundleName());
|
||||
std::string outer(ABS_CODE_PATH);
|
||||
|
||||
@@ -34,6 +34,7 @@ constexpr size_t ARGC_TWO = 2;
|
||||
constexpr size_t INDEX_ZERO = 0;
|
||||
constexpr size_t INDEX_ONE = 1;
|
||||
constexpr int32_t ERROR_CODE_ONE = 1;
|
||||
const char* MD_NAME = "JsApplicationContextUtils";
|
||||
|
||||
class JsApplicationContextUtils {
|
||||
public:
|
||||
@@ -638,19 +639,18 @@ NativeValue *CreateJsApplicationContext(NativeEngine &engine, std::shared_ptr<Ap
|
||||
BindNativeProperty(*object, "databaseDir", JsApplicationContextUtils::GetDatabaseDir);
|
||||
BindNativeProperty(*object, "preferencesDir", JsApplicationContextUtils::GetPreferencesDir);
|
||||
BindNativeProperty(*object, "bundleCodeDir", JsApplicationContextUtils::GetBundleCodeDir);
|
||||
const char *mdName = "JsApplicationContextUtils";
|
||||
BindNativeFunction(engine, *object, "registerAbilityLifecycleCallback", mdName,
|
||||
BindNativeFunction(engine, *object, "registerAbilityLifecycleCallback", MD_NAME,
|
||||
JsApplicationContextUtils::RegisterAbilityLifecycleCallback);
|
||||
BindNativeFunction(engine, *object, "unregisterAbilityLifecycleCallback", mdName,
|
||||
BindNativeFunction(engine, *object, "unregisterAbilityLifecycleCallback", MD_NAME,
|
||||
JsApplicationContextUtils::UnregisterAbilityLifecycleCallback);
|
||||
BindNativeFunction(engine, *object, "registerEnvironmentCallback", mdName,
|
||||
BindNativeFunction(engine, *object, "registerEnvironmentCallback", MD_NAME,
|
||||
JsApplicationContextUtils::RegisterEnvironmentCallback);
|
||||
BindNativeFunction(engine, *object, "unregisterEnvironmentCallback", mdName,
|
||||
BindNativeFunction(engine, *object, "unregisterEnvironmentCallback", MD_NAME,
|
||||
JsApplicationContextUtils::UnregisterEnvironmentCallback);
|
||||
BindNativeFunction(engine, *object, "createBundleContext", mdName, JsApplicationContextUtils::CreateBundleContext);
|
||||
BindNativeFunction(engine, *object, "switchArea", mdName, JsApplicationContextUtils::SwitchArea);
|
||||
BindNativeFunction(engine, *object, "getArea", mdName, JsApplicationContextUtils::GetArea);
|
||||
BindNativeFunction(engine, *object, "createModuleContext", mdName, JsApplicationContextUtils::CreateModuleContext);
|
||||
BindNativeFunction(engine, *object, "createBundleContext", MD_NAME, JsApplicationContextUtils::CreateBundleContext);
|
||||
BindNativeFunction(engine, *object, "switchArea", MD_NAME, JsApplicationContextUtils::SwitchArea);
|
||||
BindNativeFunction(engine, *object, "getArea", MD_NAME, JsApplicationContextUtils::GetArea);
|
||||
BindNativeFunction(engine, *object, "createModuleContext", MD_NAME, JsApplicationContextUtils::CreateModuleContext);
|
||||
|
||||
return objValue;
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ NativeValue* JsBaseContext::OnCreateBundleContext(NativeEngine& engine, NativeCa
|
||||
NativeValue* value = CreateJsBaseContext(engine, bundleContext, nullptr, nullptr, true);
|
||||
auto systemModule = JsRuntime::LoadSystemModuleByEngine(&engine, "application.Context", &value, 1);
|
||||
if (systemModule == nullptr) {
|
||||
HILOG_WARN("invalid systemModule.");
|
||||
HILOG_WARN("OnCreateBundleContext, invalid systemModule.");
|
||||
return engine.CreateUndefined();
|
||||
}
|
||||
auto contextObj = systemModule->Get();
|
||||
@@ -444,7 +444,7 @@ NativeValue* JsBaseContext::OnGetApplicationContext(NativeEngine& engine, Native
|
||||
NativeValue* value = CreateJsApplicationContext(engine, applicationContext, nullptr, nullptr, true);
|
||||
auto systemModule = JsRuntime::LoadSystemModuleByEngine(&engine, "application.ApplicationContext", &value, 1);
|
||||
if (systemModule == nullptr) {
|
||||
HILOG_WARN("invalid systemModule.");
|
||||
HILOG_WARN("OnGetApplicationContext, invalid systemModule.");
|
||||
return engine.CreateUndefined();
|
||||
}
|
||||
auto contextObj = systemModule->Get();
|
||||
@@ -482,13 +482,13 @@ NativeValue* AttachBaseContext(NativeEngine* engine, void* value, void*)
|
||||
NativeValue* object = CreateJsBaseContext(*engine, ptr, nullptr, nullptr, true);
|
||||
auto systemModule = JsRuntime::LoadSystemModuleByEngine(engine, "application.Context", &object, 1);
|
||||
if (systemModule == nullptr) {
|
||||
HILOG_WARN("invalid systemModule.");
|
||||
HILOG_WARN("AttachBaseContext, invalid systemModule.");
|
||||
return nullptr;
|
||||
}
|
||||
auto contextObj = systemModule->Get();
|
||||
NativeObject *nObject = ConvertNativeValueTo<NativeObject>(contextObj);
|
||||
if (nObject == nullptr) {
|
||||
HILOG_WARN("invalid nObject.");
|
||||
HILOG_WARN("AttachBaseContext, invalid nObject.");
|
||||
return nullptr;
|
||||
}
|
||||
nObject->ConvertToNativeBindingObject(engine, DetachCallbackFunc, AttachBaseContext, value, nullptr);
|
||||
|
||||
@@ -120,7 +120,7 @@ private:
|
||||
NativeValue* StartTimeoutOrInterval(NativeEngine* engine, NativeCallbackInfo* info, bool isInterval)
|
||||
{
|
||||
if (engine == nullptr || info == nullptr) {
|
||||
HILOG_ERROR("Start timeout or interval failed with engine or callback info is nullptr.");
|
||||
HILOG_ERROR("StartTimeoutOrInterval, engine or callback info is nullptr.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,27 +71,27 @@ public:
|
||||
isServiceDied_ = true;
|
||||
}
|
||||
|
||||
bool IsExtensionConnected()
|
||||
bool IsExtensionConnected() const
|
||||
{
|
||||
return isExtensionConnected_;
|
||||
}
|
||||
|
||||
bool IsExtensionDisconnected()
|
||||
bool IsExtensionDisconnected() const
|
||||
{
|
||||
return isExtensionDisconnected_;
|
||||
}
|
||||
|
||||
bool IsDlpAbilityOpened()
|
||||
bool IsDlpAbilityOpened() const
|
||||
{
|
||||
return isDlpAbilityOpened_;
|
||||
}
|
||||
|
||||
bool IsDlpAbilityClosed()
|
||||
bool IsDlpAbilityClosed() const
|
||||
{
|
||||
return isDlpAbilityClosed_;
|
||||
}
|
||||
|
||||
bool IsServiceDied()
|
||||
bool IsServiceDied() const
|
||||
{
|
||||
return isServiceDied_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user