@@ -927,12 +927,15 @@ public void println(String text) {
927927
928928 String scenarioCmd = meta .getString ("cmd" );
929929
930+ //patrh open cl version
931+ String openCLlibPath = patchOpenCL ();
932+
933+ if (openCLlibPath != null ) {
934+ libPath = libPath + ":" + openCLlibPath ;
935+ }
930936 String [] scenarioEnv = {
931937 "CT_REPEAT_MAIN=" + String .valueOf (1 ),
932938 "LD_LIBRARY_PATH=" + libPath + ":$LD_LIBRARY_PATH" ,
933-
934- //"LD_LIBRARY_PATH=" + libPath + ":/system/vendor/lib/egl/:/data/local/tmp/:$LD_LIBRARY_PATH",
935- // "LD_LIBRARY_PATH=" + libPath + ":/data/local/tmp:$LD_LIBRARY_PATH",
936939 };
937940 publishProgress ("Prepared scenario env " + scenarioEnv [0 ]);
938941 publishProgress ("Prepared scenario env " + scenarioEnv [1 ]);
@@ -961,9 +964,6 @@ public void run() {
961964
962965 publishProgress ("\n Selected scenario: " + title + "" );
963966
964- //patrh open cl version
965- patchOpenCL ();
966-
967967 //In the future we may read json output and aggregate it too (openMe)
968968 int iterationNum = 3 ; // todo it could be taken from loaded scenario
969969 List <Long > processingTimes = new LinkedList <>();
@@ -1144,15 +1144,16 @@ private void showIsThatCorrectDialog(final String recognitionResultText, final S
11441144 openResultActivity ();
11451145 }
11461146
1147- private void patchOpenCL () {
1147+ private String patchOpenCL () {
11481148 String libOpenCLFileName = "libOpenCL.so" ;
1149- String fromFileDir = "/sdcard/openscience/code" ;
1150- String fromFilePath = fromFileDir + File .separator + libOpenCLFileName ;
1149+ // String fromFileDir = "/sdcard/openscience/code";
1150+ // String fromFilePath = fromFileDir + File.separator + libOpenCLFileName;
1151+ String fromFilePath = "/system/vendor/lib/egl/libGLES_mali.so" ;
11511152
1152- String targetAppFileDir = AppConfigService .getLocalAppPath () + File .separator + "openscience" + File .separator + "code/af6493166b44399b /armeabi-v7a" ;
1153+ String targetAppFileDir = AppConfigService .getLocalAppPath () + File .separator + "openscience" + File .separator + "code/libopencl /armeabi-v7a" ;
11531154 String targetAppFilePath = targetAppFileDir + File .separator + libOpenCLFileName ;
11541155
1155- String [] rmResult = openme .openme_run_program ("rm -rf " + targetAppFilePath , null , fromFileDir );
1156+ String [] rmResult = openme .openme_run_program ("rm " + targetAppFilePath , null , targetAppFileDir );
11561157 if (rmResult [0 ].isEmpty () && rmResult [1 ].isEmpty () && rmResult [2 ].isEmpty ()) {
11571158 publishProgress (" * File " + targetAppFilePath + " successfully removed...\n " );
11581159 } else {
@@ -1164,7 +1165,7 @@ private void patchOpenCL() {
11641165 if (!appfp .exists ()) {
11651166 if (!appfp .mkdirs ()) {
11661167 publishProgress ("\n Error creating dir (" + targetAppFileDir + ") ..." );
1167- return ;
1168+ return null ;
11681169 }
11691170 }
11701171
@@ -1175,18 +1176,18 @@ private void patchOpenCL() {
11751176 } catch (IOException e ) {
11761177 e .printStackTrace ();
11771178 publishProgress ("\n Error copying file " + fromFilePath + " to " + targetAppFilePath + " ..." + e .getLocalizedMessage ());
1178- return ;
1179+ return null ;
11791180 }
11801181
1181- String [] chmodResult = openme .openme_run_program (COMMAND_CHMOD_744 + " " + targetAppFilePath , null , fromFileDir );
1182+ String [] chmodResult = openme .openme_run_program (COMMAND_CHMOD_744 + " " + targetAppFilePath , null , targetAppFileDir );
11821183 if (chmodResult [0 ].isEmpty () && chmodResult [1 ].isEmpty () && chmodResult [2 ].isEmpty ()) {
11831184 publishProgress (" * File " + targetAppFilePath + " successfully set as executable ...\n " );
11841185 } else {
11851186 publishProgress ("\n Error setting file " + fromFilePath + " as executable ..." );
1186- return ;
1187+ return null ;
11871188 }
1189+ return targetAppFileDir ;
11881190 }
1189-
11901191 }
11911192
11921193 private void openResultActivity () {
0 commit comments