Commit graph

922 commits

Author SHA1 Message Date
Fredia Huya-Kouadio 724ef83971 Add default minSdkVersion and targetSdkVersion in the AndroidManifest.xml file 2021-11-03 21:49:22 -07:00
Rémi Verschelde 87c80f529f
clang-format: Enable BreakBeforeTernaryOperators
clang-format keeps breaking the way it handles break *after* ternary operators,
so I give up and go with the only style they seem to actually test.
2021-10-28 14:50:33 +02:00
Rémi Verschelde 1b65550ec7
clang-format: Various fixes to comments alignment from clang-format 13
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
2021-10-28 14:50:32 +02:00
Rémi Verschelde 42d385b312
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 13:23:38 +02:00
Rémi Verschelde c7f4e1d5dd
Android: Properly validate godot_project_name_string for Android special chars
Fixes #52659.

(cherry picked from commit 9204a3a50e)
2021-10-26 18:23:47 +02:00
Marcel Admiraal 4febf69f2a
Fix Gradle builds not excluding excluded tasks
(cherry picked from commit f80cb4dffa)
2021-10-24 01:43:44 +02:00
Rémi Verschelde 9657559b66
SCons: Set DEBUG_ENABLED and DEV_ENABLED in SConstruct
They're the same for all platforms so they don't need to be repeated in all
platform definitions.

(cherry picked from commit cd21cc683a)
2021-10-15 12:54:16 +02:00
Marcel Admiraal fd942cd465
Upgrade Android Gradle to version 7.2
(cherry picked from commit 95b1275197)
2021-10-15 12:51:43 +02:00
ne0fhyk 754db65a1f
Pass the correct export_format argument to locate the assets directory when exporting.
(cherry picked from commit 431ccdb057)
2021-10-11 18:04:16 +02:00
Rémi Verschelde e292d79fb3
SCons: Add DEV_ENABLED defines for target=debug builds
This will allow adding developer checks which will be fully compiled out in
user builds, unlike `DEBUG_ENABLED` which is included in debug tempates and
the editor builds.

This define is not used yet, but we'll soon add code that uses it, and change
some existing `DEBUG_ENABLED` checks to be performed only in dev builds.

Related to https://github.com/godotengine/godot-proposals/issues/3371.
2021-10-04 11:25:02 +02:00
Hugo Locurcio 8a6bc045ea
Add logo attribution for Android, HTML5 and Linux platform icons
- Tweak the Android platform logo to remove the Android wordmark,
  as it can't be used without explicit permission.

(cherry picked from commit 1513aa9b26)
2021-09-21 17:14:59 +02:00
Marcel Admiraal cce7e6c9d6
Use current androidx Fragment library instead of legacy libraries
(cherry picked from commit 23311a6ed3)
2021-09-19 11:37:19 +02:00
PouleyKetchoupp 1454d6c670
Add support for adding plugin views behind the main view on Android
Doesn't change the default behavior, but allows plugins to add their
view behind the main view, which gives more control over what happens
with inputs and can be useful along with transparent rendering.

(cherry picked from commit 0b681d5834)
2021-09-19 11:30:21 +02:00
PouleyKetchoupp 52fdb4ece9 Window transparency support on Android
Implements per-pixel transparency feature on Android.
Allows plugins to do specific rendering and render godot UI on top
(useful for camera support with drawing on top).
2021-09-15 10:41:08 -07:00
ne0fhyk 35a98d305b Add support for Play Asset Delivery.
This only adds support for a subset of Play Asset Delivery: this causes a single install-time asset pack to always be present, but doesn't add support for dynamically downloaded asset packs.
2021-09-15 06:02:53 -07:00
Rémi Verschelde 815c16ae17
Merge pull request #52515 from m4gr3d/android_export_refactoring
[3.x] Refactor Android platform export structure
2021-09-15 14:03:53 +02:00
Marcus Brummer 128208d1d0
Check if vibration duration is > 0 on Android
(cherry picked from commit 47f338fc12)
2021-09-14 13:41:25 +02:00
ne0fhyk 0cfbe354d7 Refactor Android platform export structure. 2021-09-09 10:48:29 -07:00
Fredia Huya-Kouadio 5b8d7752b5 Update Oculus vr configs and add support for accessing Oculus OpenXR runtime 2021-08-27 11:16:20 -07:00
Fredia Huya-Kouadio 3baf5563e8
Delegate handling and implementation of the restart functionality to the Godot host.
(cherry picked from commit f4222733ca)
2021-08-18 23:21:13 +02:00
Rémi Verschelde 2ab45474fd
Merge pull request #51783 from m4gr3d/address_external_dir_access
Fix possible null pointer exception.
2021-08-17 13:32:33 +02:00
ne0fhyk e2bcdad43b Fix possible null pointer exception. 2021-08-16 23:14:10 -07:00
ModProg 1d63a94d19 [android] Fixed wrong button mask for right click 2021-08-16 18:41:20 +02:00
Rémi Verschelde daf922fa8a
Android: Increase default armv7 NDK platform to 19
Following #50359 this is the new minSdk that we target.
Users can still override it in custom builds if they want to support SDK 18.
2021-08-16 10:14:03 +02:00
Rémi Verschelde 028a2a7205
Merge pull request #50359 from m4gr3d/address_external_dir_access
[3.x] Add support for Android scoped storage
2021-08-16 09:48:34 +02:00
ne0fhyk c88d1608ab Add partial support for Android scoped storage.
This is done by providing API access to app specific directories which don't have any limitations and allows us to bump the target sdk version to 30.
In addition, we're also bumping the min sdk version to 19 as version 18 is no longer supported by Google Play Services and only account of 0.3% of Android devices.
2021-08-13 11:04:17 -07:00
Rémi Verschelde b484956fba
Merge pull request #51601 from RandomShaper/android_step_acq_rel
Use SafeNumeric for Android JNI step
2021-08-13 09:33:20 +02:00
Rémi Verschelde f976cec536
Merge pull request #51584 from m4gr3d/investigate_godot_resume_stalls_3_x
[3.x] Resolve issue where the Godot app remains stuck when resuming.
2021-08-13 08:44:33 +02:00
Fredia Huya-Kouadio 336c630f51 Add support for prompting the user to retain app data on uninstall.
Supported on Android 10 and higher.
2021-08-12 22:06:13 -07:00
Fredia Huya-Kouadio 874aa1708f Resolve issue where the Godot app remains stuck when resuming.
This was caused by the fact that a new instance of Godot was created at resume while a previous instance already existed.
The previous instance would then go through its cleanup lifecycle, and would thus attempt to close the entire app, leading to the system to restart the app, thus starting the cycle anew.
The fix involves reusing the previous instance of Godot if one is available instead of creating a new one, as well as giving control to the host activity for how the process should be terminated.
2021-08-12 20:58:00 -07:00
Pedro J. Estébanez 78d945e7fb Use SafeNumeric for Android JNI step
Aside from the cosmetic improvement of using the Godot-style type, this switches to acquire-release semantics, which may improve performance by not forcing a full barrier to be issued if the CPU architecture can use a cheaper one.
2021-08-13 02:48:58 +02:00
Pedro J. Estébanez 45c2a7159e Switch to input buffering on Android
Key, touch and joystick events will be passed directly from the UI thread to Godot, so they can benefit from agile input flushing.

As another consequence of this new way of passing events, less Java object are created at runtime (`Runnable`), which is good since the garbage collector needs to run less.

`AndroidInputHandler` is introduced to have a smaller cross-thread surface. `main_loop_request_go_back()` is removed in favor just inline calling `notification()` on the `MainLoop` at the most caller's convenience.

Lastly, `get_mouse_position()` and `get_mouse_button_state()` now just call through `InputDefault` to avoid the need of sync of mouse data tracked on the UI thread.
2021-08-08 13:41:27 +02:00
Haoyu Qiu 55b52341d1 Make progress and errors translatable when exporting to Android 2021-08-01 17:15:56 +08:00
Fredia Huya-Kouadio df1ebbb0aa Fix custom build export 2021-07-27 12:24:44 -07:00
ne0fhyk d1fdb60ee2 Disable resource optimizations for release builds as it breaks the legacy build system. 2021-07-20 16:36:00 -07:00
reduz ca223d71d8
Addes ability to load build sources from file.
* If not present, the dialog asks to load build sources from a file.
* The export templates check now also verifies that build sources are installed and skips the template check.

This makes Android development easier.

(cherry picked from commit 6639cc9853)
2021-07-20 13:05:10 +02:00
Rémi Verschelde 46c68c0fb9
Android: Fix truncated application attributes after #50028 cherry-pick
The `android:icon` attribute is expected to be the last one in the application
definition, as documented by the comment. cd64bcd missed that and caused some
arguments to be truncated.

Fixes #50224.
2021-07-07 00:49:07 +02:00
Rémi Verschelde 3d16bfcc40
Android: Fix syntax error in #50227 2021-07-07 00:08:59 +02:00
Rémi Verschelde 7c8cc037ad
Merge pull request #50221 from madmiraal/fix-50125-3.x
[3.x] Queue the calls to GodotLib.key when Android virtual done is pressed
2021-07-06 23:46:36 +02:00
Rémi Verschelde 8c5c79e020
Android: Fix xr_mode_metadata_name removal after cd64bcdae
I had lost that line when resolving merge conflicts.
2021-07-06 23:24:54 +02:00
Marcel Admiraal 2bd3cc0e16 Queue the calls to GodotLib.key when Android virtual done is pressed 2021-07-06 17:54:14 +01:00
Marcel Admiraal d40f73e3a4 Remove Android onKeyMultiple override 2021-07-06 17:37:53 +01:00
Rémi Verschelde 009aa63a57
Merge pull request #50108 from madmiraal/android-use-lambdas-3.x
[3.x] Replace single method anonymous classes with lambdas in Godot Java code
2021-07-06 18:10:45 +02:00
Marcel Admiraal 4b03e05573
Use static inner classes in Godot Java code
(cherry picked from commit 23e152040b)
2021-07-06 11:20:42 +02:00
Marcel Admiraal ab1162e918
Remove redundant explicit types in Godot Java code
(cherry picked from commit 3f95bbed73)
2021-07-06 11:10:46 +02:00
Marcel Admiraal 6a07253bb6
Use StringBuilder instead StringBuffer in Godot Java code
(cherry picked from commit 61ee51d2bf)
2021-07-06 11:10:46 +02:00
Marcel Admiraal c1abbfb605
Fix raw use of parameterized Class
(cherry picked from commit d237f7d33d)
2021-07-06 11:10:46 +02:00
Marcel Admiraal 01ecec451c
Use Java array declarations not C-style declarations in Android Java code
(cherry picked from commit 721b3d56c5)
2021-07-06 11:10:46 +02:00
Marcel Admiraal 2b78d618f4
Remove unnecessary semicolons from Android Java code
(cherry picked from commit 360447001d)
2021-07-06 11:10:45 +02:00
Rémi Verschelde cd64bcdae5
Android: Add isGame application attribute, default to true
It can be turned off in the export preset with `package/classify_as_game`.

Upstream definition: https://developer.android.com/guide/topics/manifest/application-element#isGame

> `android:isGame`
>
> Whether or not the application is a game. The system may group together
> applications classifed as games or display them separately from other
> applications.

Also fixes replacing `android:allowBackup` in custom builds.

(cherry picked from commit 40a594c6ea)
2021-07-06 11:10:45 +02:00