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 "core/common/ace_engine_ext.h" 17 18 #include <dlfcn.h> 19 20 #include "base/log/log.h" 21 #include "base/utils/utils.h" 22 23 namespace OHOS::Ace { 24 namespace { 25 #ifdef __aarch64__ 26 const std::string DRAG_EXTENSION_SO_PATH = "system/lib64/module/autorun/libhmos_drag_drop.z.so"; 27 #else 28 const std::string DRAG_EXTENSION_SO_PATH = "system/lib/module/autorun/libhmos_drag_drop.z.so"; 29 #endif 30 } 31 CallDragExtFunc()32void CallDragExtFunc() 33 { 34 auto handle = dlopen(DRAG_EXTENSION_SO_PATH.c_str(), RTLD_LAZY); 35 CHECK_NULL_VOID(handle); 36 auto dragFunc = reinterpret_cast<DragExtFunc>(dlsym(handle, "StartDragService")); 37 if (dragFunc == nullptr) { 38 LOGE("Failed to get drag extension func"); 39 dlclose(handle); 40 return; 41 } 42 LOGI("Call drag extension func"); 43 dragFunc(); 44 dlclose(handle); 45 } 46 } // namespace OHOS::Ace