Skip to content

Commit e6587ff

Browse files
author
Johan Vos
committed
8236448: Remove unused and repair broken Android/Dalvik code
Reviewed-by: kcr
1 parent c9519b6 commit e6587ff

File tree

12 files changed

+394
-693
lines changed

12 files changed

+394
-693
lines changed

buildSrc/android.gradle

+165-369
Large diffs are not rendered by default.

modules/javafx.graphics/src/main/java/com/sun/glass/ui/android/DalvikInput.java

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import javafx.scene.Node;
2929

3030
public class DalvikInput {
31+
/*
3132
3233
public static void onMultiTouchEvent(final int count, final int[] actions,
3334
final int[] ids, final int[] touchXs, final int[] touchYs) {
@@ -71,4 +72,5 @@ public static void setActiveNode (Node n) {
7172
public static native void onSurfaceRedrawNeededNative();
7273
7374
public static native void onConfigurationChangedNative(int flag);
75+
*/
7476
}

modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/AndroidInputDeviceRegistry.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static void gotTouchEventFromNative(int count, int[] actions, int[] ids,
5959
touchState.addPoint(p);
6060
}
6161
}
62-
instance.gotTouchEvent(touchState);
62+
Platform.runLater(() -> instance.gotTouchEvent(touchState));
6363
}
6464

6565
private void gotTouchEvent(TouchState touchState) {

modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/MonocleApplication.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,8 @@ protected Screen[] staticScreen_getScreens() {
225225
0, 0, ns.getWidth(), ns.getHeight(),
226226
0, 0, ns.getWidth(), ns.getHeight(),
227227
0, 0, ns.getWidth(), ns.getHeight(),
228-
ns.getDPI(), ns.getDPI(),
229-
ns.getScale(), ns.getScale(),
230-
ns.getScale(), ns.getScale());
228+
ns.getWidth(), ns.getHeight(),
229+
1.f, 1.f, ns.getScale(), ns.getScale());
231230
// Move the cursor to the middle of the screen
232231
MouseState mouseState = new MouseState();
233232
mouseState.setX(ns.getWidth() / 2);

modules/javafx.graphics/src/main/native-glass/monocle/EGL.c

+16
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@
3030

3131
#include <stdlib.h>
3232

33+
//Builtin library entrypoint
34+
JNIEXPORT jint JNICALL
35+
JNI_OnLoad_glass_monocle(JavaVM *vm, void * reserved) {
36+
fprintf(stderr, "In JNI_OnLoad_glass)monocle\n");
37+
#ifdef JNI_VERSION_1_8
38+
//min. returned JNI_VERSION required by JDK8 for builtin libraries
39+
JNIEnv *env;
40+
if ((*vm)->GetEnv(vm, (void **)&env, JNI_VERSION_1_8) != JNI_OK) {
41+
return JNI_VERSION_1_4;
42+
}
43+
return JNI_VERSION_1_8;
44+
#else
45+
return JNI_VERSION_1_4;
46+
#endif
47+
}
48+
3349
void setEGLAttrs(jint *attrs, int *eglAttrs) {
3450
int index = 0;
3551

modules/javafx.graphics/src/main/native-glass/monocle/android/AndroidScreen.c

+3-7
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@
2424
*/
2525

2626
#include <android/native_window_jni.h>
27-
// #include "activity.h"
28-
#include "dalvikInput.h"
27+
#include "nativeBridge.h"
2928
#include "com_sun_glass_ui_monocle_AndroidScreen.h"
3029
#include "Monocle.h"
31-
#include "logging.h"
3230

3331

3432
/*
@@ -69,7 +67,7 @@ JNIEXPORT jint JNICALL Java_com_sun_glass_ui_monocle_AndroidScreen__1getHeight
6967
JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_monocle_AndroidScreen__1getNativeHandle
7068
(JNIEnv *env, jobject obj) {
7169
ANativeWindow* androidWindow = android_getNativeWindow(env);
72-
return androidWindow;
70+
return (jlong)androidWindow;
7371
}
7472

7573
/*
@@ -79,9 +77,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_monocle_AndroidScreen__1getNativeH
7977
*/
8078
JNIEXPORT jfloat JNICALL Java_com_sun_glass_ui_monocle_AndroidScreen__1getDensity
8179
(JNIEnv *env, jobject obj) {
82-
jfloat answer = android_getDensity();
83-
LOGI("DENSITY", "GETDENSITY, answer = %f\n",answer);
84-
return answer;
80+
return android_getDensity(env);
8581
}
8682

8783

modules/javafx.graphics/src/main/native-glass/monocle/android/dalvikInput.c

-249
This file was deleted.

modules/javafx.graphics/src/main/native-glass/monocle/android/dalvikUtils.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* questions.
2424
*/
2525

26-
#if (defined(ANDROID_NDK) && defined(DALVIK_VM))
26+
#if defined(ANDROID_NDK)
2727

2828
#include <android/keycodes.h>
2929
#include "dalvikConst.h"
@@ -60,6 +60,7 @@ int to_jfx_key_action(int action) {
6060
case KEY_ACTION_MULTIPLE:
6161
return com_sun_glass_events_KeyEvent_TYPED;
6262
}
63+
return -1;
6364
}
6465

6566
int to_linux_keycode(int androidKeyCode) {
@@ -120,6 +121,7 @@ char *describe_key_action(int action) {
120121
case KEY_ACTION_MULTIPLE:
121122
return "KEY_ACTION_MULTIPLE";
122123
}
124+
return "UNKNOWN";
123125
}
124126

125127
#endif

0 commit comments

Comments
 (0)