mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-13 18:04:35 -05:00
58923f2ef9
Signed-off-by: Tavi <tavi@divested.dev>
257 lines
13 KiB
Diff
257 lines
13 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
|
Date: Mon, 9 Oct 2023 14:21:11 +0300
|
|
Subject: [PATCH] constify JNINativeMethod tables
|
|
|
|
fd '.+\.(c|cpp|cc)$' --type file --exec sed -i 's/static JNINativeMethod/static const JNINativeMethod/'
|
|
---
|
|
cmds/hid/jni/com_android_commands_hid_Device.cpp | 2 +-
|
|
cmds/uinput/jni/com_android_commands_uinput_Device.cpp | 2 +-
|
|
core/jni/LayoutlibLoader.cpp | 2 +-
|
|
core/jni/android_app_ActivityThread.cpp | 2 +-
|
|
core/jni/android_os_HidlMemory.cpp | 2 +-
|
|
core/jni/android_os_HwBinder.cpp | 2 +-
|
|
core/jni/android_os_HwBlob.cpp | 2 +-
|
|
core/jni/android_os_HwParcel.cpp | 2 +-
|
|
core/jni/android_os_HwRemoteBinder.cpp | 2 +-
|
|
libs/hwui/jni/android_graphics_DisplayListCanvas.cpp | 2 +-
|
|
media/jni/android_media_ImageWriter.cpp | 4 ++--
|
|
media/jni/android_media_MediaSync.cpp | 2 +-
|
|
media/jni/soundpool/android_media_SoundPool.cpp | 2 +-
|
|
services/core/jni/com_android_server_UsbAlsaMidiDevice.cpp | 2 +-
|
|
.../com_android_server_companion_virtual_InputController.cpp | 2 +-
|
|
services/core/jni/com_android_server_tv_TvUinputBridge.cpp | 2 +-
|
|
.../jni/android_view_tests_ChoreographerNativeTest.cpp | 2 +-
|
|
17 files changed, 18 insertions(+), 18 deletions(-)
|
|
|
|
diff --git a/cmds/hid/jni/com_android_commands_hid_Device.cpp b/cmds/hid/jni/com_android_commands_hid_Device.cpp
|
|
index 8b8d361edbd4..60aa5e4267aa 100644
|
|
--- a/cmds/hid/jni/com_android_commands_hid_Device.cpp
|
|
+++ b/cmds/hid/jni/com_android_commands_hid_Device.cpp
|
|
@@ -368,7 +368,7 @@ static void closeDevice(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) {
|
|
}
|
|
}
|
|
|
|
-static JNINativeMethod sMethods[] = {
|
|
+static const JNINativeMethod sMethods[] = {
|
|
{"nativeOpenDevice",
|
|
"(Ljava/lang/String;IIII[B"
|
|
"Lcom/android/commands/hid/Device$DeviceCallback;)J",
|
|
diff --git a/cmds/uinput/jni/com_android_commands_uinput_Device.cpp b/cmds/uinput/jni/com_android_commands_uinput_Device.cpp
|
|
index bd61000186e5..3179c8a28e47 100644
|
|
--- a/cmds/uinput/jni/com_android_commands_uinput_Device.cpp
|
|
+++ b/cmds/uinput/jni/com_android_commands_uinput_Device.cpp
|
|
@@ -325,7 +325,7 @@ static jint getEvdevInputPropByLabel(JNIEnv* env, jclass /* clazz */, jstring ra
|
|
return InputEventLookup::getLinuxEvdevInputPropByLabel(label.c_str()).value_or(-1);
|
|
}
|
|
|
|
-static JNINativeMethod sMethods[] = {
|
|
+static const JNINativeMethod sMethods[] = {
|
|
{"nativeOpenUinputDevice",
|
|
"(Ljava/lang/String;IIIIIILjava/lang/String;"
|
|
"Lcom/android/commands/uinput/Device$DeviceCallback;)J",
|
|
diff --git a/core/jni/LayoutlibLoader.cpp b/core/jni/LayoutlibLoader.cpp
|
|
index d5f17da0a072..05c6388aa445 100644
|
|
--- a/core/jni/LayoutlibLoader.cpp
|
|
+++ b/core/jni/LayoutlibLoader.cpp
|
|
@@ -69,7 +69,7 @@ static void NativeAllocationRegistry_Delegate_nativeApplyFreeFunction(JNIEnv*, j
|
|
nativeFreeFunction(nativePtr);
|
|
}
|
|
|
|
-static JNINativeMethod gMethods[] = {
|
|
+static const JNINativeMethod gMethods[] = {
|
|
NATIVE_METHOD(NativeAllocationRegistry_Delegate, nativeApplyFreeFunction, "(JJ)V"),
|
|
};
|
|
|
|
diff --git a/core/jni/android_app_ActivityThread.cpp b/core/jni/android_app_ActivityThread.cpp
|
|
index e25ba76cbbeb..16a8d4656179 100644
|
|
--- a/core/jni/android_app_ActivityThread.cpp
|
|
+++ b/core/jni/android_app_ActivityThread.cpp
|
|
@@ -33,7 +33,7 @@ static void android_app_ActivityThread_initZygoteChildHeapProfiling(JNIEnv* env,
|
|
android_mallopt(M_INIT_ZYGOTE_CHILD_PROFILING, nullptr, 0);
|
|
}
|
|
|
|
-static JNINativeMethod gActivityThreadMethods[] = {
|
|
+static const JNINativeMethod gActivityThreadMethods[] = {
|
|
// ------------ Regular JNI ------------------
|
|
{ "nPurgePendingResources", "()V",
|
|
(void*) android_app_ActivityThread_purgePendingResources },
|
|
diff --git a/core/jni/android_os_HidlMemory.cpp b/core/jni/android_os_HidlMemory.cpp
|
|
index 69e48184c0ad..612fc95776a5 100644
|
|
--- a/core/jni/android_os_HidlMemory.cpp
|
|
+++ b/core/jni/android_os_HidlMemory.cpp
|
|
@@ -50,7 +50,7 @@ static void nativeFinalize(JNIEnv* env, jobject jobj) {
|
|
delete native;
|
|
}
|
|
|
|
-static JNINativeMethod gMethods[] = {
|
|
+static const JNINativeMethod gMethods[] = {
|
|
{"nativeFinalize", "()V", (void*) nativeFinalize},
|
|
};
|
|
|
|
diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp
|
|
index 734b5f497e2e..d6c1e00d9b4a 100644
|
|
--- a/core/jni/android_os_HwBinder.cpp
|
|
+++ b/core/jni/android_os_HwBinder.cpp
|
|
@@ -396,7 +396,7 @@ static void JHwBinder_report_sysprop_change(JNIEnv * /*env*/, jclass /*clazz*/)
|
|
report_sysprop_change();
|
|
}
|
|
|
|
-static JNINativeMethod gMethods[] = {
|
|
+static const JNINativeMethod gMethods[] = {
|
|
{ "native_init", "()J", (void *)JHwBinder_native_init },
|
|
{ "native_setup", "()V", (void *)JHwBinder_native_setup },
|
|
|
|
diff --git a/core/jni/android_os_HwBlob.cpp b/core/jni/android_os_HwBlob.cpp
|
|
index e554b44233b5..065937f935fb 100644
|
|
--- a/core/jni/android_os_HwBlob.cpp
|
|
+++ b/core/jni/android_os_HwBlob.cpp
|
|
@@ -599,7 +599,7 @@ static jlong JHwBlob_native_handle(JNIEnv *env, jobject thiz) {
|
|
return handle;
|
|
}
|
|
|
|
-static JNINativeMethod gMethods[] = {
|
|
+static const JNINativeMethod gMethods[] = {
|
|
{ "native_init", "()J", (void *)JHwBlob_native_init },
|
|
{ "native_setup", "(I)V", (void *)JHwBlob_native_setup },
|
|
|
|
diff --git a/core/jni/android_os_HwParcel.cpp b/core/jni/android_os_HwParcel.cpp
|
|
index 0e3c51047b31..edda99533f63 100644
|
|
--- a/core/jni/android_os_HwParcel.cpp
|
|
+++ b/core/jni/android_os_HwParcel.cpp
|
|
@@ -1066,7 +1066,7 @@ static void JHwParcel_native_writeBuffer(
|
|
}
|
|
}
|
|
|
|
-static JNINativeMethod gMethods[] = {
|
|
+static const JNINativeMethod gMethods[] = {
|
|
{ "native_init", "()J", (void *)JHwParcel_native_init },
|
|
{ "native_setup", "(Z)V", (void *)JHwParcel_native_setup },
|
|
|
|
diff --git a/core/jni/android_os_HwRemoteBinder.cpp b/core/jni/android_os_HwRemoteBinder.cpp
|
|
index d2d7213e5761..497aa193eb4d 100644
|
|
--- a/core/jni/android_os_HwRemoteBinder.cpp
|
|
+++ b/core/jni/android_os_HwRemoteBinder.cpp
|
|
@@ -452,7 +452,7 @@ static jint JHwRemoteBinder_hashCode(JNIEnv* env, jobject thiz) {
|
|
return static_cast<jint>(longHash ^ (longHash >> 32)); // See Long.hashCode()
|
|
}
|
|
|
|
-static JNINativeMethod gMethods[] = {
|
|
+static const JNINativeMethod gMethods[] = {
|
|
{ "native_init", "()J", (void *)JHwRemoteBinder_native_init },
|
|
|
|
{ "native_setup_empty", "()V",
|
|
diff --git a/libs/hwui/jni/android_graphics_DisplayListCanvas.cpp b/libs/hwui/jni/android_graphics_DisplayListCanvas.cpp
|
|
index 426644ee6a4e..f886d7dc4e5c 100644
|
|
--- a/libs/hwui/jni/android_graphics_DisplayListCanvas.cpp
|
|
+++ b/libs/hwui/jni/android_graphics_DisplayListCanvas.cpp
|
|
@@ -174,7 +174,7 @@ static void android_view_DisplayListCanvas_drawWebViewFunctor(CRITICAL_JNI_PARAM
|
|
|
|
const char* const kClassPathName = "android/graphics/RecordingCanvas";
|
|
|
|
-static JNINativeMethod gMethods[] = {
|
|
+static const JNINativeMethod gMethods[] = {
|
|
{"nGetMaximumTextureWidth", "()I", (void*)android_view_DisplayListCanvas_getMaxTextureSize},
|
|
{"nGetMaximumTextureHeight", "()I",
|
|
(void*)android_view_DisplayListCanvas_getMaxTextureSize},
|
|
diff --git a/media/jni/android_media_ImageWriter.cpp b/media/jni/android_media_ImageWriter.cpp
|
|
index f64233fb9c79..a99fcea46911 100644
|
|
--- a/media/jni/android_media_ImageWriter.cpp
|
|
+++ b/media/jni/android_media_ImageWriter.cpp
|
|
@@ -1114,7 +1114,7 @@ static jobjectArray Image_createSurfacePlanes(JNIEnv* env, jobject thiz,
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
-static JNINativeMethod gImageWriterMethods[] = {
|
|
+static const JNINativeMethod gImageWriterMethods[] = {
|
|
{"nativeClassInit", "()V", (void*)ImageWriter_classInit },
|
|
{"nativeInit", "(Ljava/lang/Object;Landroid/view/Surface;IIIZIIJ)J",
|
|
(void*)ImageWriter_init },
|
|
@@ -1131,7 +1131,7 @@ static JNINativeMethod gImageWriterMethods[] = {
|
|
{"cancelImage", "(JLandroid/media/Image;)V", (void*)ImageWriter_cancelImage },
|
|
};
|
|
|
|
-static JNINativeMethod gImageMethods[] = {
|
|
+static const JNINativeMethod gImageMethods[] = {
|
|
{"nativeCreatePlanes", "(II)[Landroid/media/ImageWriter$WriterSurfaceImage$SurfacePlane;",
|
|
(void*)Image_createSurfacePlanes },
|
|
{"nativeGetWidth", "()I", (void*)Image_getWidth },
|
|
diff --git a/media/jni/android_media_MediaSync.cpp b/media/jni/android_media_MediaSync.cpp
|
|
index d1ce30a3e827..d93bda166c44 100644
|
|
--- a/media/jni/android_media_MediaSync.cpp
|
|
+++ b/media/jni/android_media_MediaSync.cpp
|
|
@@ -514,7 +514,7 @@ static void android_media_MediaSync_native_finalize(JNIEnv *env, jobject thiz) {
|
|
android_media_MediaSync_release(env, thiz);
|
|
}
|
|
|
|
-static JNINativeMethod gMethods[] = {
|
|
+static const JNINativeMethod gMethods[] = {
|
|
{ "native_setSurface",
|
|
"(Landroid/view/Surface;)V",
|
|
(void *)android_media_MediaSync_native_setSurface },
|
|
diff --git a/media/jni/soundpool/android_media_SoundPool.cpp b/media/jni/soundpool/android_media_SoundPool.cpp
|
|
index e872a58c96cf..fd6fb80d6867 100644
|
|
--- a/media/jni/soundpool/android_media_SoundPool.cpp
|
|
+++ b/media/jni/soundpool/android_media_SoundPool.cpp
|
|
@@ -563,7 +563,7 @@ android_media_SoundPool_release(JNIEnv *env, jobject thiz)
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// Dalvik VM type signatures
|
|
-static JNINativeMethod gMethods[] = {
|
|
+static const JNINativeMethod gMethods[] = {
|
|
{ "_load",
|
|
"(Ljava/io/FileDescriptor;JJI)I",
|
|
(void *)android_media_SoundPool_load_FD
|
|
diff --git a/services/core/jni/com_android_server_UsbAlsaMidiDevice.cpp b/services/core/jni/com_android_server_UsbAlsaMidiDevice.cpp
|
|
index 93938b1ff1bc..47b22c5fd39f 100644
|
|
--- a/services/core/jni/com_android_server_UsbAlsaMidiDevice.cpp
|
|
+++ b/services/core/jni/com_android_server_UsbAlsaMidiDevice.cpp
|
|
@@ -138,7 +138,7 @@ static void android_server_UsbAlsaMidiDevice_close(JNIEnv *env, jobject thiz, jo
|
|
}
|
|
}
|
|
|
|
-static JNINativeMethod method_table[] = {
|
|
+static const JNINativeMethod method_table[] = {
|
|
{"nativeOpen", "(IIII)[Ljava/io/FileDescriptor;",
|
|
(void *)android_server_UsbAlsaMidiDevice_open},
|
|
{"nativeClose", "([Ljava/io/FileDescriptor;)V",
|
|
diff --git a/services/core/jni/com_android_server_companion_virtual_InputController.cpp b/services/core/jni/com_android_server_companion_virtual_InputController.cpp
|
|
index 50d48b7d30e7..12afdeaf0a38 100644
|
|
--- a/services/core/jni/com_android_server_companion_virtual_InputController.cpp
|
|
+++ b/services/core/jni/com_android_server_companion_virtual_InputController.cpp
|
|
@@ -381,7 +381,7 @@ static bool nativeWriteStylusButtonEvent(JNIEnv* env, jobject thiz, jlong ptr, j
|
|
std::chrono::nanoseconds(eventTimeNanos));
|
|
}
|
|
|
|
-static JNINativeMethod methods[] = {
|
|
+static const JNINativeMethod methods[] = {
|
|
{"nativeOpenUinputDpad", "(Ljava/lang/String;IILjava/lang/String;)J",
|
|
(void*)nativeOpenUinputDpad},
|
|
{"nativeOpenUinputKeyboard", "(Ljava/lang/String;IILjava/lang/String;)J",
|
|
diff --git a/services/core/jni/com_android_server_tv_TvUinputBridge.cpp b/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
|
|
index 99deab4fd652..2cb1aaef13fa 100644
|
|
--- a/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
|
|
+++ b/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
|
|
@@ -534,7 +534,7 @@ static void nativeClear(JNIEnv* env, jclass clazz, jlong ptr) {
|
|
* JNI registration
|
|
*/
|
|
|
|
-static JNINativeMethod gUinputBridgeMethods[] = {
|
|
+static const JNINativeMethod gUinputBridgeMethods[] = {
|
|
{"nativeOpen", "(Ljava/lang/String;Ljava/lang/String;III)J", (void*)nativeOpen},
|
|
{"nativeGamepadOpen", "(Ljava/lang/String;Ljava/lang/String;)J", (void*)nativeGamepadOpen},
|
|
{"nativeClose", "(J)V", (void*)nativeClose},
|
|
diff --git a/tests/ChoreographerTests/jni/android_view_tests_ChoreographerNativeTest.cpp b/tests/ChoreographerTests/jni/android_view_tests_ChoreographerNativeTest.cpp
|
|
index 27f4bae9e65a..b5620251d41b 100644
|
|
--- a/tests/ChoreographerTests/jni/android_view_tests_ChoreographerNativeTest.cpp
|
|
+++ b/tests/ChoreographerTests/jni/android_view_tests_ChoreographerNativeTest.cpp
|
|
@@ -151,7 +151,7 @@ static void android_view_ChoreographerNativeTest_testPostVsyncCallbackAtFrameRat
|
|
endTest(env, clazz);
|
|
}
|
|
|
|
-static JNINativeMethod gMethods[] = {
|
|
+static const JNINativeMethod gMethods[] = {
|
|
{"nativeSurfaceControl_getChoreographer", "(Landroid/view/SurfaceControl;)J",
|
|
(void*)SurfaceControl_getChoreographer},
|
|
{"nativeTestPostVsyncCallbackAtFrameRate", "(JF)V",
|