1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <display_type.h>
17 #include <display_manager.h>
18 #include <event_handler.h>
19 #include "boot_animation.h"
20 #include "util.h"
21 #include "core/transaction/rs_interfaces.h"
22
23 using namespace OHOS;
24
main(int argc,const char * argv[])25 int main(int argc, const char *argv[])
26 {
27 LOGI("main enter");
28 WaitRenderServiceInit();
29
30 auto& dms = OHOS::Rosen::DisplayManager::GetInstance();
31 auto displayIds = dms.GetAllDisplayIds();
32
33 while (displayIds.empty()) {
34 LOGI("displayIds is empty, retry to get displayIds");
35 displayIds = dms.GetAllDisplayIds();
36 usleep(SLEEP_TIME_US);
37 }
38
39 Rosen::RSInterfaces& interface = Rosen::RSInterfaces::GetInstance();
40 Rosen::ScreenId defaultId = interface.GetDefaultScreenId();
41 if (defaultId == Rosen::INVALID_SCREEN_ID) {
42 LOGE("invalid default screen id, return");
43 return 0;
44 }
45
46 auto display = dms.GetDisplayByScreen(defaultId);
47 BootAnimation bootAnimation;
48 bootAnimation.Run(defaultId, display->GetWidth(), display->GetHeight());
49
50 LOGI("main exit");
51 return 0;
52 }
53