• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/utils/utils.h"
21 
22 namespace OHOS::Ace {
23 namespace {
24 #if (defined(__aarch64__) || defined(__x86_64__))
25 const std::string DRAG_EXTENSION_SO_PATH = "system/lib64/module/autorun/libhmos_drag_drop.z.so";
26 #else
27 const std::string DRAG_EXTENSION_SO_PATH = "system/lib/module/autorun/libhmos_drag_drop.z.so";
28 #endif
29 }
30 
CallDragExtFunc()31 void CallDragExtFunc()
32 {
33     auto handle = dlopen(DRAG_EXTENSION_SO_PATH.c_str(), RTLD_LAZY);
34     CHECK_NULL_VOID(handle);
35     auto dragFunc = reinterpret_cast<DragExtFunc>(dlsym(handle, "StartDragService"));
36     if (dragFunc == nullptr) {
37         TAG_LOGE(AceLogTag::ACE_DRAG, "Failed to get drag extension func");
38         dlclose(handle);
39         return;
40     }
41     TAG_LOGI(AceLogTag::ACE_DRAG, "Call drag extension func");
42     dragFunc();
43     dlclose(handle);
44 }
45 } // namespace OHOS::Ace