Commit Graph

441 Commits (cb1569345a6f17da08241e645ab03cb2e1b78d2f)

Author SHA1 Message Date
Alexander Hartmann a1e12dca3f Fix `Input.vibrate_handheld` on Android. 2025-06-12 12:38:18 +07:00
Rémi Verschelde 6e5bcd2f41
Merge pull request #107207 from syntaxerror247/filePicker-save
Android: Fix save issue when using native file dialog
2025-06-10 12:30:21 +07:00
Anish Mishra a28697f2fe Android: Fix save issue when using native file dialog
Fixes the issue where saving a file without `MANAGE_EXTERNAL_STORAGE` permission using the `native file dialog` to get the file path causes the `ERR_FILE_NOT_FOUND` error.
2025-06-06 16:07:41 +07:00
Fredia Huya-Kouadio a0cb64569b Fix the `CAMERA` permission request on HorizonOS devices 2025-06-05 14:56:07 +07:00
Fredia Huya-Kouadio 547450befd Fix transparency background issue on Android
Fixes https://github.com/godotengine/godot/issues/106703
2025-06-02 22:45:16 +07:00
Fredia Huya-Kouadio 658d3736f4 Update the documentation for `JavaClassWrapper` and `AndroidRuntimePlugin`
Follow-up to https://github.com/godotengine/godot-docs/pull/10979
2025-05-30 09:39:53 +07:00
Thaddeus Crews 5620a215a1
Merge pull request #106021 from Alex2782/fix_xbox_controller_on_android
Fix Xbox Controller on Android
2025-05-16 07:43:09 +07:00
Leo de Penning 296ca79b9d Add CameraFeed support for Android
Co-authored-by: KOGA Mitsuhiro <shiena.jp@gmail.com>
2025-05-13 22:46:06 +07:00
Rémi Verschelde c1d3746a67
Merge pull request #105992 from uno1982/4.5-dev-fix-android-controller
Fix issues with Android controller input handling
2025-05-13 01:04:52 +07:00
Fredia Huya-Kouadio c29545f793 Bump the minimum supported SDK version to 24
Raise the minimum supported Android version from Android 5 (Lollipop) to Android 7 (Nougat).
2025-05-08 09:45:32 +07:00
Alexander Hartmann cf00265386 Fix Xbox Controller on Android 2025-05-03 01:09:05 +07:00
uno1982 5ce11b1eac Fix for ps4 and ps5 controller options and share buttons 2025-05-01 11:30:02 +07:00
Thaddeus Crews 485406b5e0
Merge pull request #104819 from m4gr3d/setup_godot_tools_lib_maven_central
Add maven publishing configuration for Godot tools
2025-04-16 10:45:14 +07:00
Thaddeus Crews 9906016959
Merge pull request #105301 from syntaxerror247/fix-decimal-keyboard
Android: Fix decimal keyboard
2025-04-15 12:28:46 +07:00
Anish Mishra 8f0a642f6c Android: Fix Decimal keyboard 2025-04-15 08:09:37 +07:00
Thaddeus Crews 4972a524fc
Merge pull request #96139 from Alex2782/reverting_pr_84331
Add configuration option to disable `Scroll Deadzone` on Android
2025-04-11 09:51:08 +07:00
Alex cd68034e01 Add configuration option to disable `Scroll Deadzone` on Android 2025-04-07 22:15:31 +07:00
Anish Mishra b462db5adb Android: Hardware keyboard connection status callback
Adds a DisplayServer method to register hardware keyboard connection change callback.
2025-04-05 08:14:29 +07:00
Fredia Huya-Kouadio 19700dacdf Add maven publishing configuration for Godot tools
The Godot Android library on MavenCentral is a `template` build; this updated configuration adds a new 'Godot Tools' publishing artifact, allowing developers access to the `editor` build of the Godot Android library.
2025-03-31 10:29:06 +07:00
Anish Mishra afe68f672f Add support for "Mute Game" toggle in the Android Editor 2025-03-21 01:33:38 +07:00
Thaddeus Crews e9e4760335
Merge pull request #83538 from bruvzg/size_and_at
[FileAccess] Implement `get_size` and `get_access_time` methods.
2025-03-11 14:00:58 +07:00
Thaddeus Crews 56bc9bc2f4
Merge pull request #102984 from syntaxerror247/volume-buttons
Android: enable support for volume button events
2025-03-11 09:34:46 +07:00
bruvzg 85d3be8070
[FileAccess] Implement `get_size` and `get_access_time` methods. 2025-03-09 16:07:00 +07:00
Fredia Huya-Kouadio bea6472ea4 Fix Android mouse capture issues
- Allow mouse capture to be enabled in `_ready`
- Update the input handler logic to avoid dropping mouse captured motion events
2025-02-28 13:54:30 +07:00
Anish Mishra 5ce16dfc69 Android: enable support for volume button events
- Enable events KEY_VOLUMEUP and KEY_VOLUMEDOWN on Android.

- Adds a project setting to override volume buttons. It would disable system volume changes when the buttons are used within the project.
2025-02-28 09:47:22 +07:00
Anish Mishra 28d1dccf63
Android: Fix export and runtime logic to check if using Vulkan
Also fix iOS export logic that would force a min target of iOS 14.0 (for Metal)
even when targeting the Compatibility renderer.

Co-authored-by: Pāvels Nadtočajevs <7645683+bruvzg@users.noreply.github.com>
2025-02-23 12:28:59 +07:00
Anish Mishra ee4e809d4c Android: Fix excessive getRotation calls 2025-02-21 20:32:54 +07:00
Fredia Huya-Kouadio 2a66335ec2 Address API regression from https://github.com/godotengine/godot/pull/101050 2025-02-11 10:19:47 +07:00
Fredia Huya-Kouadio 7495a8a02e Add support for embedding game process in the Android Editor
- Implement Android editor specific `EmbeddedGodotGame` to support embedding the game window in the Android editor
2025-02-11 02:20:18 +07:00
Anish Mishra b89957efce Android: Add Snackbar UI component 2025-02-08 22:09:46 +07:00
Thaddeus Crews b0655dc86f
Merge pull request #101050 from jamie-pate/fix_android_godot_app_create_instance
Fix create_instance in android GodotApp so non-editor apps can restart
2025-01-22 16:32:29 +07:00
Thaddeus Crews 24fb28af55
Merge pull request #101689 from syntaxerror247/native-dialogs
Make dialogs non-cancelable on Android
2025-01-20 10:05:43 +07:00
Jamie Pate 605b97075f Fix create_instance in android GodotApp so non-editor apps can restart
Enables OS.create_instance(args) and OS.set_restart_on_exit(true, args)
on android.

Borrowed the logic from the editor, so it completely restarts the
process so you can pass --rendering-method, --rendering-driver to switch
between forward_plus, mobile, gl_compatibility etc on an exported app.

Related:
https://github.com/godotengine/godot-proposals/issues/6423
2025-01-19 03:23:45 +07:00
Anish Mishra 401310d74d
Make dialogs non-cancelable on Android. 2025-01-17 19:45:34 +07:00
Fredia Huya-Kouadio b4f25b1863 Clean up the XR editor logic
- Coalesce common logic into the `main` flavor to avoid duplication
- Code cleanup
2025-01-16 09:40:30 +07:00
Rémi Verschelde 4d1cfc1784 Merge pull request #101061 from syntaxerror247/first-pr-2025
Android: Implement support for `native dialog`
2025-01-14 15:05:59 +07:00
Anish Mishra cb9ee099ac Android: Implement support for native dialog
This adds support for DisplayServer::dialog_show() on Android, aligning it with the functionality already available on macOS and Windows.
2025-01-14 15:03:14 +07:00
Anish Mishra 867ae4d85a Update Android editor name and add missing icons 2025-01-14 13:46:45 +07:00
Rémi Verschelde b7c0a0fbd1 Merge pull request #101387 from picoxr/add-picoos-immersivemode
Add PICO OS Immersive Mode
2025-01-13 20:22:11 +07:00
ygz-bd a2bfb7cff2 Enable XR Preview Mode for PICO OS
Supported features in the immersive preview mode
- Passthrough
- Hand tracking
Notes:
- Multi-window is only available for internal apps on PICO OS, therefore launching adjacent windows is not possible currently.
- Passthrough splash screen is not supported on PICO OS
2025-01-13 16:34:22 +07:00
Fredia Huya-Kouadio 7ad9d23a1d Updates how the `REQUEST_INSTALL_PACKAGES` permission is handled
- Only request the permission the first time the editor tries to open an apk
- Disable the permission for the HorizonOS build as the HorizonOS store doesn't support it yet
2024-12-25 20:04:34 +07:00
Anish Mishra 9deee0097a Fix Android native file picker 2024-12-19 19:31:32 +07:00
Fredia Huya-Kouadio 23cea1b9d2 Additional fixes and improvements to JavaClassWrapper
- Fix crashing bug when invoking class constructor with parameters
- Add support for accessing class constants
- Add support for Godot Callable arguments. A Godot Callable can be wrapped by a Java Runnable to allow Java logic to run arbitrary Godot lambdas
- Automatically convert java.lang.CharSequence to Godot String as needed
- Code cleanup
2024-12-17 18:46:34 +07:00
Rémi Verschelde cb5b1ecc25
Merge pull request #100200 from syntaxerror247/android-base-color
Android: Support for `base color` retrieval
2024-12-18 00:39:45 +07:00
Rémi Verschelde 66b8101cef
Merge pull request #95460 from m4gr3d/enable_mouse_forward_back_buttons
Enable `BUTTON_FORWARD` and `BUTTON_BACK` mouse buttons on Android
2024-12-17 22:59:20 +07:00
Anish Mishra 70b24c3d16 Android: Support for base color retrieval 2024-12-18 02:14:48 +07:00
Thaddeus Crews 156bc92282
Merge pull request #98397 from adamscott/add-tmp-support
Add temp utilities (alias `OS::get_temp_dir()`, `FileAccess::create_temp()`, and `DirAccess::create_temp()`)
2024-12-03 14:40:59 +07:00
Thaddeus Crews 6e8c0a43c3
Merge pull request #99378 from syntaxerror247/optional_monochrome_icon
Android: Refactor icon logic and make monochrome icon optional
2024-12-03 14:40:52 +07:00
Adam Scott 1b3e483899
Add file and dir temporary utilities
Co-authored by @Alex2782 for the Android bindings.
Many thanks to the reviewers also.

Co-authored-by: Alex <alex.hart.278@gmail.com>
2024-12-02 12:08:14 +07:00
Anish Mishra f767cf00fd Android: Make monochrome icon optional 2024-12-02 22:04:38 +07:00
Rémi Verschelde a702b69ce7
Merge pull request #98917 from syntaxerror247/immersive-mode-issue
Android: Fix immersive mode issue
2024-12-02 15:50:57 +07:00
bruvzg a4b17e7852 [FileAccess] Return error codes from `store_*` methods. 2024-11-29 23:22:31 +07:00
Thaddeus Crews 150c69c0f2
Merge pull request #99694 from dsnopek/android-os-create-instance-return-value
Android: `OS.create_instance()` should return `-1` on failure
2024-11-27 10:47:30 +07:00
David Snopek 38e0532ffa Android: `OS.create_instance()` should return `-1` on failure 2024-11-25 15:58:06 +07:00
Anish Mishra 57541d53d3 Android: Extension support for native file dialog 2024-11-19 22:16:32 +07:00
Thaddeus Crews cb411fa960
Merge pull request #98687 from m4gr3d/disable_swappy_requirement_for_as_debug_builds
Update the `production` build argument for Android Studio debug builds
2024-11-12 12:13:23 +07:00
Anish Mishra 6445b6cbdd Android: Fix immersive mode issue 2024-11-07 18:29:25 +07:00
Thaddeus Crews b00e1cbf74
Merge pull request #97631 from m4gr3d/prompt_apk_install_after_generation
[Android editor] Enable automatic install of exported apks for the Android editor
2024-11-04 21:52:08 +07:00
Thaddeus Crews 7d950c1567
Merge pull request #98712 from syntaxerror247/android_accent_color
[Android] Implement support for accent color retrieval
2024-11-04 21:52:04 +07:00
Thaddeus Crews 2b49543478
Merge pull request #98709 from darksylinc/matias-upsidedown-splash
Fix splash screen upside down on Android
2024-11-04 21:52:01 +07:00
Anish Mishra 7b866f302f [Android] Implement support for accent color retrieval 2024-11-01 16:19:09 +07:00
Matias N. Goldberg b9a2f108fc Fix splash screen upside down on Android
Fixes an issue introduced in #96439 (see
https://github.com/godotengine/godot/pull/96439#issuecomment-2447288702)

Godot was relying on Java's
activity.getWindowManager().getDefaultDisplay().getRotation(); to apply
pre-rotation but this is wrong.

First, getRotation() may temporarily return a different value from the
correct one; which is what was causing the splash screen to be upside
down. It would return -90 instead of 90 for the first rendered frame.

But unfortunately, the splash screen is just one frame rendered for a
very long time, so the error lingered for a long time for everyone to
see.

Second, to determine what rotation to use, we should be looking at what
Vulkan told us, which is the value we pass to
VkSurfaceTransformFlagBitsKHR::preTransform.

This commit removes the now-unnecessary
screen_get_internal_current_rotation() function (which was introduced by
#96439) and now saves the preTransform value in the swapchain.
2024-10-31 16:52:26 +07:00
Fredia Huya-Kouadio d699d4b7d4 Update the `production` build argument for Android Studio debug builds
Swappy is required for `production` build which breaks the Android Studio debug builds as those turns on the `production` argument.
This commit updates the logic so that the `production` argument is only used by Android Studio for `release` builds.
2024-10-30 21:15:31 +07:00
Anish Mishra b2130efb31 [Android] Implement native file picker support 2024-10-30 14:53:02 +07:00
Thaddeus Crews 05a4620e88
Merge pull request #98615 from Summersay415/three-opengls-please
Fix fallbacks to OpenGL
2024-10-29 19:25:48 +07:00
Thaddeus Crews 08d8909a65
Merge pull request #98574 from syntaxerror247/android_input_dialog
[Android] Implement native input dialog support
2024-10-29 19:25:37 +07:00
Clay John 748f4079e3
Merge pull request #96439 from darksylinc/matias-TheForge-pr03-rebased
Add Swappy & Pre-Transformed Swapchain
2024-10-29 12:34:40 +07:00
Anish Mishra be5d7f757d [Android] Implement native input dialog support 2024-10-29 20:02:08 +07:00
Fredia Huya-Kouadio af2423ba4d Enable automatic install of export apks for the Android editor 2024-10-28 16:12:16 +07:00
Matias N. Goldberg aaa0e2fddf Add Swappy & Pre-Transformed Swapchain
- Adds Swappy for Android for stable frame pacing
- Implements pre-transformed Swapchain so that Godot's compositor is in
charge of rotating the screen instead of Android's compositor
(performance optimization for phones that don't have HW rotator)

============================

The work was performed by collaboration of TheForge and Google. I am
merely splitting it up into smaller PRs and cleaning it up.

Changes from original PR:

- Removed "display/window/frame_pacing/android/target_frame_rate" option
to use Engine::get_max_fps instead.
- Target framerate can be changed at runtime using Engine::set_max_fps.
- Swappy is enabled by default.
- Added documentation.
- enable_auto_swap setting is replaced with swappy_mode.
2024-10-28 18:55:37 +07:00
Summersay415 6d14cd6ff9 Fix fallbacks to OpenGL 2024-10-28 22:57:19 +07:00
Andreas Raddau 90c35f3978 Fix Android app permissions for SDK levels earlier than 28 2024-10-16 12:47:18 +07:00
bruvzg 25f439c573
[DisplayServer] Implement has_hardware_keyboard method for Android and iOS. 2024-10-02 20:09:48 +07:00
Fredia Huya-Kouadio 5e0805a813 Provide access to the Android runtime to GDScript
Thanks for the fix of `JavaClassWrapper` in https://github.com/godotengine/godot/pull/96182 and the changes in the previous commit, this introduces an `AndroidRuntime` plugin which provides GDScript access to the Android runtime capabilities.

This allows developers to get access to various Android capabilities without the need of a plugin.
For example, the following logic can be used to check whether the device supports vibration:

```
var android_runtime = Engine.get_singleton("AndroidRuntime")
 if android_runtime:
 	print("Checking if the device supports vibration")
 	var vibrator_service = android_runtime.getApplicationContext().getSystemService("vibrator")
 	if vibrator_service:
 		if vibrator_service.hasVibrator():
 			print("Vibration is supported on device!")
 		else:
 			printerr("Vibration is not supported on device")
 	else:
 		printerr("Unable to retrieve the vibrator service")
 else:
 	printerr("Couldn't find AndroidRuntime singleton")
```
2024-09-29 14:32:10 +07:00
Anish Mishra dbcc7f3051
Add support for Android Themed Icons (monochrome) 2024-09-27 13:56:34 +07:00
Thaddeus Crews b37fc1014a
Style: Apply new `clang-format` changes 2024-09-20 08:09:48 +07:00
Fredia Huya-Kouadio 741efa632a Update the Android editor flavors to avoid vendor-specific references 2024-09-13 08:53:29 +07:00
devloglogan 16e1d8a81b Disable some editor settings by default in the XR Editor 2024-09-09 07:15:15 +07:00
Fredia Huya-Kouadio 9dc0543da7 Improve support for XR projects 2024-09-06 00:35:50 +07:00
Fredia Huya-Kouadio d1891adced Enable `BUTTON_FORWARD` and `BUTTON_BACK` mouse buttons on Android 2024-09-01 11:01:49 +07:00
Fredia Huya-Kouadio 923b0f2e56 Restore 'Toggle fullscreen' menu for the Android editor and clean up the immersive mode logic 2024-08-28 09:50:34 +07:00
Fredia Huya-Kouadio 961394a988 Add support for launching the Play window in PiP mode 2024-08-28 03:18:51 +07:00
Fredia Huya-Kouadio 6a9c060883 Add support to the Android editor for signing and verifying Android apks
- Apk signing and verification is enabled using the apksig library from ac5cbb07d8
2024-08-26 11:38:49 +07:00
Fredia Huya-Kouadio a5897d579b Update the `GodotHost` interface to support signing and verifying Android apks
Update the export logic to enable apk generation and signing for Android editor builds

Note: Only legacy builds are supported. Gradle builds are not supported at this point in time.
2024-08-26 11:16:38 +07:00
Fredia Huya-Kouadio 794ea99240 Update the storage access handler logic to support accessing / retrieving contents with the `assets:/` prefix 2024-08-26 11:16:37 +07:00
Rémi Verschelde 82adfebcf8
Merge pull request #94799 from m4gr3d/memory_allocation_cleanup_and_optimizations
Android memory cleanup and optimizations
2024-08-16 23:45:39 +07:00
Fredia Huya-Kouadio a57a99f5bc Memory cleanup and optimizations
- Returns an empty list when there's not registered plugins, thus preventing the creation of spurious iterator objects

- Inline `Godot#getRotatedValues(...)` given it only had a single caller. This allows to remove the allocation of a float array on each call and replace it with float variables

- Disable sensor events by default. Sensor events can fired at 10-100s Hz taking cpu and memory resources. Now the use of sensor data is behind a project setting allowing projects that have use of it to enable it, while other projects don't pay the cost for a feature they don't use

- Create a pool of specialized input `Runnable` objects to prevent spurious, unbounded `Runnable` allocations

- Disable showing the boot logo for Android XR projects

- Delete locale references of jni strings
2024-08-16 09:27:41 +07:00
Fredia Huya-Kouadio cde873b406 Update the Android `fileLastModified` method to return values in seconds instead of milliseconds 2024-08-15 12:24:58 +07:00
Fredia Huya-Kouadio 4d0da74014 Fix the cleanup logic for the Android render thread
On Android the exit logic goes through `Godot#onDestroy()` who attempts to cleanup the engine using the following code:

```
runOnRenderThread {
	GodotLib.ondestroy()
	forceQuit()
}
```

The issue however is that by the time we ran this code, the render thread has already been paused (but not yet destroyed), and thus `GodotLib.ondestroy()` and `forceQuit()` which are scheduled on the render thread are not executed.

To address this, we instead explicitly request the render thread to exit and block until it does. As part of it exit logic, the render thread has been updated to properly destroy and clean the native instance of the Godot engine, resolving the issue.
2024-07-24 10:17:46 +07:00
Rémi Verschelde a4312eebaa
Merge pull request #94468 from m4gr3d/restart_editor_when_updating_touchscreen_settings
[Android Editor] Resolve issues with the editor touchscreen settings
2024-07-17 12:24:14 +07:00
Fredia Huya-Kouadio 53a752f2d6 Disable long press for mouse events
Long press is used to simulate right-click events for finger touch and stylus. The previous logic also caused it to trigger for mouse input, which is not needed since the user can instead use the mouse right click button.

This update disables long press as right click events for mouse input.
2024-07-17 02:44:17 +07:00
Fredia Huya-Kouadio 5e59819727 Cleanup Android input on render thread settings
Follow up to https://github.com/godotengine/godot/pull/93933
Clean up the set of settings use to control whether Android input should be dispatched on the render thread.

Addresses comments in https://github.com/godotengine/godot/pull/93933#issuecomment-2210437977
2024-07-09 09:15:18 +07:00
Fredia Huya-Kouadio 6b6428d779 Fix ANRs reported by the Google Play Console
- Add support for dispatching input on the render thread (UI thread is the current default) when `input_buffering` and `accumulated_input` are disabled. At the expense of latency, this helps prevent 'heavy' applications / games from blocking the UI thread (the default behavior)  which may cause the application to ANR.

- Remove GLSurfaceView logic causing the UI thread to wait on the GL thread during lifecycle events. The removed logic would cause the UI thread to ANR when the GL thread is blocked.
2024-07-04 05:18:50 +07:00
Fredia Huya-Kouadio c6a23a7a7d Fix crashes reported by the Google Play Console 2024-07-04 02:46:11 +07:00
Rémi Verschelde de8a05f447
Merge pull request #92965 from m4gr3d/fix_splash_screen
Update the Android splash screen logic
2024-06-13 17:19:27 +07:00
Tareq Anuar d14bea4413
Move the most specific motion event guard to the top of the function. 2024-06-11 12:10:09 +07:00
Fredia Huya-Kouadio dd966f5680 Configure the splash screen for the Android editor 2024-06-10 00:34:00 +07:00
Fredia Huya-Kouadio 53279d2510 Fix invalid return value when multiple permission requests are dispatched 2024-06-02 17:22:51 +07:00
Rémi Verschelde a6ef250f3e
Merge pull request #92133 from m4gr3d/fix_touch_input
Fix invalid detection of mouse input
2024-05-29 23:03:27 +07:00
Alexander Hartmann ab9e377fe6 Fix InputEventScreenDrag on Android 2024-05-21 01:04:23 +07:00