1/** 2 * Copyright (c) 2021-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 */ 15import ConfigData from '../../../../../../../common/utils/src/main/ets/default/baseUtil/ConfigData'; 16import ISettingsController from '../../../../../../../common/component/src/main/ets/default/controller/ISettingsController' 17import SwitchController from '../../../../../../../common/component/src/main/ets/default/controller/SwitchController' 18import LogUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil'; 19import {LogAll} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogDecorator'; 20import parameter from '@ohos.systemparameter'; 21const MODULE_TAG = ConfigData.TAG + '.OverdrawController -> '; 22@LogAll 23export default class OverdrawController extends SwitchController { 24 /** 25 * Initialize data. 26 */ 27 initData(): ISettingsController { 28 super.initData(); 29 return this; 30 } 31 /** 32 * Get usb current functions state 33 */ 34 getUsbCurrentFunctions() { 35 } 36 37 /** 38 * After current value changed event 39 */ 40 afterCurrentValueChanged() { 41 if(this.isOn){ 42 parameter.set("debug.graphic.overdraw", "true").then(()=>{ 43 LogUtil.info(MODULE_TAG + "open overdraw success") 44 }).catch((err)=>{ 45 LogUtil.info(MODULE_TAG + "open overdraw fail" + JSON.stringify(err)) 46 }); 47 } else { 48 parameter.set("debug.graphic.overdraw", "false").then(()=>{ 49 LogUtil.info(MODULE_TAG + " close overdraw success") 50 }) .catch((err)=>{ 51 LogUtil.info(MODULE_TAG + " close overdraw fail " + JSON.stringify(err)) 52 }); 53 } 54 } 55}