Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8097946

[Android] On dalvik, don't use android library

XMLWordPrintable

      On Android, libglass_lens_android.so could be used, but when running on top of Dalvik, libactivity.so should be used

      The following patch fixes this:
      diff -r 9f5303fb78fb modules/graphics/src/main/native-prism-es2/eglfb/wrapped_egl.c
      --- a/modules/graphics/src/main/native-prism-es2/eglfb/wrapped_egl.c Fri Jun 13 12:36:57 2014 +1200
      +++ b/modules/graphics/src/main/native-prism-es2/eglfb/wrapped_egl.c Fri Jun 13 11:05:29 2014 +0200
      @@ -156,16 +156,23 @@
           }
       
       #ifdef ANDROID_NDK
      +#ifdef DALVIK_VM
      +#define ANDROID_LIB "libactivity.so"
      +#define GET_NATIVE_WINDOW "android_getNativeWindow"
      +#else
      +#define ANDROID_LIB "libglass_lens_android.so"
      +#define GET_NATIVE_WINDOW "ANDROID_getNativeWindow"
      +#endif
           //don't cache for Android!
      - printf("Using getAndroidNativeWindow() from glass.\n");
      - void *libglass_android = dlopen("libglass_lens_android.so", RTLD_LAZY | RTLD_GLOBAL);
      + printf("Using %s\n", ANDROID_LIB);
      + void *libglass_android = dlopen(ANDROID_LIB, RTLD_LAZY | RTLD_GLOBAL);
           if (!libglass_android) {
      - fprintf(stderr, "Did not find libglass_lens_android.so %s\n", dlerror());
      + fprintf(stderr, "Did not find %s %s\n", ANDROID_LIB, dlerror());
                  return NULL;
           }
      - _ANDROID_getNativeWindow = dlsym(libglass_android, "ANDROID_getNativeWindow");
      + _ANDROID_getNativeWindow = dlsym(libglass_android, GET_NATIVE_WINDOW);
           if (!_ANDROID_getNativeWindow) {
      - fprintf(stderr, "Did not find symbol \"ANDROID_getNativeWindow\" %s\n", dlerror());
      + fprintf(stderr, "Did not find symbol \"%s\" %s\n", GET_NATIVE_WINDOW, dlerror());
              return NULL;
           }
           return (*_ANDROID_getNativeWindow)();

            ddhill David Hill (Inactive)
            jvos Johan Vos
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: