Commit 0210db302a8f69aa215b2a3015b7b7c4690a2e72
Committed by
Adeel Kazmi
1 parent
8fa6f63e
Load libraries directly from apk instead of file path
Android 6 or higher support loading libraies directly from apk 64bit dali demo fail to run due to specifying wrong path By not specifying path, we can directly dlopen from apk One less place to have bug Change-Id: I53619979798ab2d4fbccf25a152d92e52e467d0b
Showing
1 changed file
with
8 additions
and
2 deletions
build/android/app/src/main/cpp/main.cpp
| @@ -187,7 +187,13 @@ void android_main(struct android_app* state) | @@ -187,7 +187,13 @@ void android_main(struct android_app* state) | ||
| 187 | DaliDemoNativeActivity nativeActivity(state->activity); | 187 | DaliDemoNativeActivity nativeActivity(state->activity); |
| 188 | 188 | ||
| 189 | int status = 0; | 189 | int status = 0; |
| 190 | - std::string libpath = "/data/data/com.sec.dalidemo/lib/libdali-demo.so"; | 190 | + |
| 191 | + //dali requires Android 8 or higher | ||
| 192 | + //Android 6+ support loading library directly from apk, | ||
| 193 | + //therefore no need to extract to filesystem first then open by specifying full path | ||
| 194 | + //unless there is need to do profiling, or export libraries so that other packages can use | ||
| 195 | + std::string libpath = "libdali-demo.so"; | ||
| 196 | + | ||
| 191 | std::string callParam = nativeActivity.GetIntentStringExtra("start"); | 197 | std::string callParam = nativeActivity.GetIntentStringExtra("start"); |
| 192 | if(callParam.empty()) | 198 | if(callParam.empty()) |
| 193 | { | 199 | { |
| @@ -196,7 +202,7 @@ void android_main(struct android_app* state) | @@ -196,7 +202,7 @@ void android_main(struct android_app* state) | ||
| 196 | 202 | ||
| 197 | if(!callParam.empty()) | 203 | if(!callParam.empty()) |
| 198 | { | 204 | { |
| 199 | - libpath = "/data/data/com.sec.dalidemo/lib/lib" + callParam + ".so"; | 205 | + libpath = "lib" + callParam + ".so"; |
| 200 | } | 206 | } |
| 201 | 207 | ||
| 202 | void* handle = dlopen(libpath.c_str(), RTLD_LAZY); | 208 | void* handle = dlopen(libpath.c_str(), RTLD_LAZY); |