1e0dac50fSopenharmony_ci/*
2e0dac50fSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
3e0dac50fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4e0dac50fSopenharmony_ci * you may not use this file except in compliance with the License.
5e0dac50fSopenharmony_ci * You may obtain a copy of the License at
6e0dac50fSopenharmony_ci *
7e0dac50fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8e0dac50fSopenharmony_ci *
9e0dac50fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10e0dac50fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11e0dac50fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12e0dac50fSopenharmony_ci * See the License for the specific language governing permissions and
13e0dac50fSopenharmony_ci * limitations under the License.
14e0dac50fSopenharmony_ci */
15e0dac50fSopenharmony_ci
16e0dac50fSopenharmony_ci#include <iostream>
17e0dac50fSopenharmony_ci#include "display_manager.h"
18e0dac50fSopenharmony_ci
19e0dac50fSopenharmony_ciusing namespace OHOS;
20e0dac50fSopenharmony_ciusing namespace OHOS::Rosen;
21e0dac50fSopenharmony_ci
22e0dac50fSopenharmony_ciint main(int argc, char *argv[])
23e0dac50fSopenharmony_ci{
24e0dac50fSopenharmony_ci    auto displayId = DisplayManager::GetInstance().GetDefaultDisplayId();
25e0dac50fSopenharmony_ci    std::vector<DisplayId> ids;
26e0dac50fSopenharmony_ci    ids.push_back(displayId);
27e0dac50fSopenharmony_ci    if (argc < 2) { // 2 is arg number
28e0dac50fSopenharmony_ci        std::cout << "Invalid operation." << std::endl;
29e0dac50fSopenharmony_ci        return 0;
30e0dac50fSopenharmony_ci    }
31e0dac50fSopenharmony_ci    if (atoi(argv[1]) == 1) {
32e0dac50fSopenharmony_ci        if (DisplayManager::GetInstance().Freeze(ids)) {
33e0dac50fSopenharmony_ci            std::cout << "Freeze display success." << std::endl;
34e0dac50fSopenharmony_ci            return 0;
35e0dac50fSopenharmony_ci        }
36e0dac50fSopenharmony_ci    } else if (atoi(argv[1]) == 0) {
37e0dac50fSopenharmony_ci        if (DisplayManager::GetInstance().Unfreeze(ids)) {
38e0dac50fSopenharmony_ci            std::cout << "Unfreeze display success." << std::endl;
39e0dac50fSopenharmony_ci            return 0;
40e0dac50fSopenharmony_ci        }
41e0dac50fSopenharmony_ci    } else {
42e0dac50fSopenharmony_ci        std::cout << "Invalid cmd." << std::endl;
43e0dac50fSopenharmony_ci        return 0;
44e0dac50fSopenharmony_ci    }
45e0dac50fSopenharmony_ci    std::cout << "Freeze/Unfreeze failed." << std::endl;
46e0dac50fSopenharmony_ci    return 0;
47e0dac50fSopenharmony_ci}