84 lines
2.7 KiB
C++
84 lines
2.7 KiB
C++
/*
|
|
* Copyright (c) 2020-2021 CompanyNameMagicTag.
|
|
* 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 "NativeRegisterManager.h"
|
|
#include "NativeLauncher.h"
|
|
#include "SliceProxy.h"
|
|
#include "AbilitySliceProxy.h"
|
|
#include "wearable_log.h"
|
|
#include "CallerLogModel.h"
|
|
#include "ActivityModel.h"
|
|
#include "HeartModel.h"
|
|
#include "PlayersModel.h"
|
|
#include "HealthModel.h"
|
|
#include "VocassistModel.h"
|
|
#include "ScreenModels.h"
|
|
#include "BluetoothHeadsetEvent.h"
|
|
#include "graphic_hardware_config.h"
|
|
#include "graphic_service.h"
|
|
#include "common/graphic_startup.h"
|
|
#ifdef JS_ENABLE
|
|
#include "product_adapter.h"
|
|
#endif
|
|
|
|
namespace OHOS {
|
|
|
|
NativeLauncher::NativeLauncher() {}
|
|
NativeLauncher::~NativeLauncher() {}
|
|
|
|
NativeLauncher &NativeLauncher::GetInstance(void)
|
|
{
|
|
static NativeLauncher instance;
|
|
return instance;
|
|
}
|
|
|
|
void NativeLauncher::InitNativeLauncher()
|
|
{
|
|
#ifdef JS_ENABLE
|
|
ACELite::ProductAdapter::SetScreenSize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
|
|
#endif
|
|
GraphicStartUp::InitFontEngine(MEM_POOL_UI_FONT, MEM_POOL_UI_FONT_SIZE,
|
|
OHOS::VECTOR_FONT_DIR, DEFAULT_VECTOR_FONT_FILENAME);
|
|
WEARABLE_LOGI(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "NativeLauncher::InitNativeLauncher");
|
|
// 初始化所有预加载slice
|
|
InitBtHeadsetEvent(); // 蓝牙ct和tg适配初始化
|
|
InitAllNativeSlices();
|
|
CallerLogModel::GetInstance()->InitPhoneService();
|
|
PlayersModel::GetInstance()->AudioInit();
|
|
ActivityModel::GetInstance()->Init();
|
|
ScreenModels::GetInstance()->InitKvStorage();
|
|
VocassistModel::GetInstance()->Init();
|
|
HeartModel::GetInstance()->Init();
|
|
BluetoothModel::GetInstance()->Init();
|
|
// 初始化默认首页
|
|
ScreenModels::GetInstance()->PreLoadAppimages();
|
|
NativeAbility::GetInstance().SetDefaultSliceId(VIEW_MAIN_SAMPLE);
|
|
}
|
|
|
|
void NativeLauncher::InitAllNativeSlices(void)
|
|
{
|
|
Graphic::Vector<NativeMap>& natives = NativeRegisterManager::GetInstance().GetNatives();
|
|
for(uint16_t index =0; index < natives.Size(); index++) {
|
|
if (static_cast<uint16_t>(natives[index].type) >= VIEW_MAX_INTER_APP) {
|
|
continue;
|
|
}
|
|
natives[index].native->InitSlice();
|
|
}
|
|
NativeRegisterManager::GetInstance().InitAllNativesSlices();
|
|
return;
|
|
}
|
|
|
|
}
|