mirror of
https://github.com/openharmony/ace_engine_lite.git
synced 2026-07-18 18:34:29 -04:00
62515236d1
Signed-off-by: SimonLi <likailong@huawei.com>
77 lines
2.1 KiB
C++
Executable File
77 lines
2.1 KiB
C++
Executable File
/*
|
|
* Copyright (c) 2020-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.
|
|
*/
|
|
|
|
#include "platform_adapter.h"
|
|
#include <cstdlib>
|
|
#include "acelite_config.h"
|
|
#if (defined(__LINUX__) || defined(__LITEOS_A__))
|
|
#include "ace_ability.h"
|
|
#endif
|
|
#include "ace_log.h"
|
|
#include "ace_version.h"
|
|
#include "js_fwk_common.h"
|
|
#include "product_adapter.h"
|
|
|
|
namespace OHOS {
|
|
namespace ACELite {
|
|
void PrintVersionTrace()
|
|
{
|
|
#if (TARGET_SIMULATOR == 1)
|
|
// output version trace on simulator
|
|
HILOG_DEBUG(HILOG_MODULE_ACE, "ACELite version: %{public}s", ACEVersion::GetStr());
|
|
HILOG_DEBUG(HILOG_MODULE_ACE, "ACELite commit: %{public}s", ACEVersion::GetCommit());
|
|
HILOG_DEBUG(HILOG_MODULE_ACE, "ACELite build stamp: %{public}s", ACEVersion::GetTimeStamp());
|
|
#endif // TARGET_SIMULATOR
|
|
}
|
|
|
|
void SetEngineSnapshotMode(bool &mode)
|
|
{
|
|
#if (TARGET_SIMULATOR != 1)
|
|
mode = true;
|
|
#else
|
|
mode = false;
|
|
#endif
|
|
}
|
|
|
|
void SetEngineSnapshotModeManually(bool &mode)
|
|
{
|
|
#if (defined(__LINUX__) || defined(__LITEOS_A__))
|
|
// if not starting debugger, on real device, give a chance to use JS mode manually
|
|
mode = IsFileExisted(RUNTIME_MODE_FILE_PATH);
|
|
#elif (TARGET_SIMULATOR != 1)
|
|
mode = !(IsFileExisted(RUNTIME_MODE_FILE_PATH));
|
|
#endif
|
|
}
|
|
|
|
void Terminate(uint16_t token)
|
|
{
|
|
#if (TARGET_SIMULATOR != 1) // no AMS support on PC simulator
|
|
#if (FEATURE_TERMINATE_ABILITY == 1)
|
|
ProductAdapter::SendTerminatingRequest(token, false);
|
|
#else
|
|
AceAbility::TerminateSelf();
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
void Srand(unsigned seed)
|
|
{
|
|
#if (TARGET_SIMULATOR == 1)
|
|
srand(seed);
|
|
#endif // TARGET_SIMULATOR
|
|
}
|
|
} // namespace ACELite
|
|
} // namespace OHOS
|