1 /* 2 * Copyright (c) 2024 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 "define_multimodal.h" 17 #include "input_screen_capture_monitor_listener.h" 18 #include "mmi_log.h" 19 20 #undef MMI_LOG_TAG 21 #define MMI_LOG_TAG "InputScreenCapture" 22 23 namespace OHOS { 24 namespace MMI { 25 #if defined(OHOS_BUILD_ENABLE_MONITOR) && defined(PLAYER_FRAMEWORK_EXISTS) 26 namespace { 27 sptr<InputScreenCaptureMonitorListener> g_screenCaptureMonitorListener { nullptr }; 28 } 29 IsScreenCaptureWorking()30extern "C" int32_t IsScreenCaptureWorking() 31 { 32 int32_t pid = Media::ScreenCaptureMonitor::GetInstance()->IsScreenCaptureWorking(); 33 return pid; 34 } 35 RegisterListener(ScreenCaptureCallback callback)36extern "C" void RegisterListener(ScreenCaptureCallback callback) 37 { 38 if (g_screenCaptureMonitorListener == nullptr) { 39 g_screenCaptureMonitorListener = new (std::nothrow) InputScreenCaptureMonitorListener(); 40 CHKPV(g_screenCaptureMonitorListener); 41 } 42 g_screenCaptureMonitorListener->SetScreenCaptureCallback(callback); 43 Media::ScreenCaptureMonitor::GetInstance()->RegisterScreenCaptureMonitorListener(g_screenCaptureMonitorListener); 44 } 45 #endif 46 } 47 }