1 /* 2 * Copyright (c) 2022 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 <iostream> 17 #include "display_manager.h" 18 19 using namespace OHOS; 20 using namespace OHOS::Rosen; 21 main(int argc,char * argv[])22int main(int argc, char *argv[]) 23 { 24 auto displayId = DisplayManager::GetInstance().GetDefaultDisplayId(); 25 std::vector<DisplayId> ids; 26 ids.push_back(displayId); 27 if (argc < 2) { // 2 is arg number 28 std::cout << "Invalid operation." << std::endl; 29 return 0; 30 } 31 if (atoi(argv[1]) == 1) { 32 if (DisplayManager::GetInstance().Freeze(ids)) { 33 std::cout << "Freeze display success." << std::endl; 34 return 0; 35 } 36 } else if (atoi(argv[1]) == 0) { 37 if (DisplayManager::GetInstance().Unfreeze(ids)) { 38 std::cout << "Unfreeze display success." << std::endl; 39 return 0; 40 } 41 } else { 42 std::cout << "Invalid cmd." << std::endl; 43 return 0; 44 } 45 std::cout << "Freeze/Unfreeze failed." << std::endl; 46 return 0; 47 }