From 878069f9abbb0a199ef1d6a9a25077dc2dd269f3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Sep 2025 11:55:17 +0000 Subject: [PATCH 1/5] Initial plan From 43d2425cbf2b2ff11467bfddf2e72855707cb03f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Sep 2025 12:01:05 +0000 Subject: [PATCH 2/5] Add conditional 16KB page size support to Android application Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- build.gradle | 2 +- cgeDemo/build.gradle | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 2b8c0ca1..0b046423 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ allprojects { ext { android = [ - compileSdkVersion: 30, + compileSdkVersion: 35, // Updated to support Android 15 for 16KB page sizes buildToolsVersion: '34.0.0', minSdkVersion : 21, targetSdkVersion : 25, // higher target version needs more storage permission request. diff --git a/cgeDemo/build.gradle b/cgeDemo/build.gradle index 9472762c..dbf07ed4 100644 --- a/cgeDemo/build.gradle +++ b/cgeDemo/build.gradle @@ -11,6 +11,10 @@ def usingCMakeCompileDebug() { return gradle.ext != null && gradle.ext.has("usingCMakeCompileDebug") && gradle.ext.usingCMakeCompileDebug; } +def enable16kPageSizes() { + return gradle.ext != null && gradle.ext.has("enable16kPageSizes") && gradle.ext.enable16kPageSizes; +} + android { compileSdkVersion rootProject.ext.android.compileSdkVersion buildToolsVersion rootProject.ext.android.buildToolsVersion @@ -22,7 +26,8 @@ android { defaultConfig { applicationId rootProject.ext.android.applicationId minSdkVersion rootProject.ext.android.minSdkVersion - targetSdkVersion rootProject.ext.android.targetSdkVersion + // Use Android 15+ (API 35) when 16KB page sizes are enabled, otherwise use default + targetSdkVersion enable16kPageSizes() ? 35 : rootProject.ext.android.targetSdkVersion versionCode rootProject.ext.android.versionCode versionName rootProject.ext.android.versionName signingConfig signingConfigs.debug From a93db6d7fa4450dd7fae773eb55a09d5217c7b79 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 11 Sep 2025 03:03:50 +0000 Subject: [PATCH 3/5] Fix RECORD_AUDIO permission lint error for higher target SDK Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- library/src/main/AndroidManifest.xml | 1 + .../main/java/org/wysaid/view/CameraRecordGLSurfaceView.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index c7e7078d..bb6ebfea 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -1,2 +1,3 @@ + \ No newline at end of file diff --git a/library/src/main/java/org/wysaid/view/CameraRecordGLSurfaceView.java b/library/src/main/java/org/wysaid/view/CameraRecordGLSurfaceView.java index c5b9ea5a..6d895de5 100644 --- a/library/src/main/java/org/wysaid/view/CameraRecordGLSurfaceView.java +++ b/library/src/main/java/org/wysaid/view/CameraRecordGLSurfaceView.java @@ -5,6 +5,7 @@ */ +import android.annotation.SuppressLint; import android.content.Context; import android.media.AudioFormat; import android.media.AudioRecord; @@ -162,6 +163,7 @@ class AudioRecordRunnable implements Runnable { ShortBuffer audioBuffer; StartRecordingCallback recordingCallback; + @SuppressLint("MissingPermission") private AudioRecordRunnable(StartRecordingCallback callback) { recordingCallback = callback; try { From f63ff17a02e9e78cf82140d9ba52f8b37eacc103 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 11 Sep 2025 10:02:33 +0000 Subject: [PATCH 4/5] Fix android:exported requirement for Android 15+ target SDK Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- cgeDemo/src/main/AndroidManifest.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cgeDemo/src/main/AndroidManifest.xml b/cgeDemo/src/main/AndroidManifest.xml index ec3256f7..34b30f8c 100644 --- a/cgeDemo/src/main/AndroidManifest.xml +++ b/cgeDemo/src/main/AndroidManifest.xml @@ -26,7 +26,8 @@ + android:label="@string/app_name" + android:exported="true"> From cfddd41555e76769679eb708d8087811acc1fb63 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Sep 2025 20:07:34 +0800 Subject: [PATCH 5/5] Add automatic 16KB page size detection and status reporting to CGE library (#548) * Initial plan * Implement 16KB page size runtime detection in CGE library Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> * Complete 16KB page size detection feature with documentation Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> * Add test activity and finalize 16KB page size detection implementation Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> * fix permission * fix error print * remove useless file * fix * fix2 * update AGP --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> Co-authored-by: wysaid Co-authored-by: wangyang (wysaid) --- build.gradle | 4 +- cgeDemo/src/main/AndroidManifest.xml | 10 ++-- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- library/src/main/jni/CMakeLists.txt | 1 + .../main/jni/interface/cgeNativeLibrary.cpp | 53 +++++++++++++++++++ 6 files changed, 63 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 0b046423..180d8004 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:8.7.3' + classpath 'com.android.tools.build:gradle:8.10.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong @@ -31,7 +31,7 @@ ext { minSdkVersion : 21, targetSdkVersion : 25, // higher target version needs more storage permission request. versionCode : 2, - versionName : "3.1.0", + versionName : "3.1.1", applicationId : "org.wysaid.cgeDemo", appcompatX : "1.2.0", ndkVersion : "26.3.11579264", diff --git a/cgeDemo/src/main/AndroidManifest.xml b/cgeDemo/src/main/AndroidManifest.xml index 34b30f8c..36eb99b2 100644 --- a/cgeDemo/src/main/AndroidManifest.xml +++ b/cgeDemo/src/main/AndroidManifest.xml @@ -11,11 +11,11 @@ - + + target_link_options(CGE PUBLIC -Wl,-z,max-page-size=16384,-z,common-page-size=16384) + target_compile_definitions(CGE PRIVATE ENABLE_16K_PAGE_SIZES=1) message("ENABLE_16K_PAGE_SIZES=${ENABLE_16K_PAGE_SIZES}") endif() diff --git a/library/src/main/jni/interface/cgeNativeLibrary.cpp b/library/src/main/jni/interface/cgeNativeLibrary.cpp index 4a6a6345..4dc4d2ff 100644 --- a/library/src/main/jni/interface/cgeNativeLibrary.cpp +++ b/library/src/main/jni/interface/cgeNativeLibrary.cpp @@ -17,9 +17,58 @@ #include #include #include +#include +#include +#include using namespace CGE; +// Function to check 16KB page size status +static void cgeCheck16kPageSize() { + const char* status = "Unknown"; + const char* details = ""; + + // 1. Check compile-time support +#ifdef ENABLE_16K_PAGE_SIZES + bool compileTimeSupport = true; +#else + bool compileTimeSupport = false; +#endif + + // 2. Check runtime Android version (16KB pages are supported from Android 15, API 35) + int apiLevel = android_get_device_api_level(); + bool systemSupport = (apiLevel >= 35); + + // 3. Check actual page size being used + long pageSize = sysconf(_SC_PAGESIZE); + bool activelyUsing16k = (pageSize == 16384); + + // Determine status and details + if (!compileTimeSupport) { + status = "DISABLED"; + details = "16KB page size support not enabled at compile time"; + } else if (!systemSupport) { + status = "COMPILE_READY"; + details = "16KB support compiled in, but Android version < 35 (Android 15)"; + } else if (activelyUsing16k) { + status = "ACTIVE"; + details = "16KB page size is fully active and working"; + } else { + status = "SUPPORTED_BUT_INACTIVE"; + details = "16KB support available but current page size is not 16KB"; + } + + // Log comprehensive status - use CGE_LOG_KEEP for important status info + CGE_LOG_KEEP("=== CGE 16KB Page Size Status ==="); + CGE_LOG_KEEP("Status: %s", status); + CGE_LOG_KEEP("Details: %s", details); + CGE_LOG_INFO("Compile-time support: %s", compileTimeSupport ? "YES" : "NO"); + CGE_LOG_INFO("Android API Level: %d (16KB support needs API 35+)", apiLevel); + CGE_LOG_INFO("Current page size: %ld bytes", pageSize); + CGE_LOG_INFO("16KB pages active: %s", activelyUsing16k ? "YES" : "NO"); + CGE_LOG_KEEP("================================"); +} + extern "C" { JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) @@ -27,6 +76,10 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) cgeGl3StubInit(); cgeGl31StubInit(); CGE_LOG_INFO("JNI_OnLoad called. cgeGl3StubInit called.\n"); + + // Check and report 16KB page size status + cgeCheck16kPageSize(); + return JNI_VERSION_1_6; }