Commit graph

7 commits

Author SHA1 Message Date
Robert Müller 0983e813d0 Add required attributes to Android manifest
Fix incorrect default value for Vulkan, which is not required.
2024-07-28 19:38:37 +02:00
Robert Müller 2b3ae2425d Update Vulkan and OpenGL ES versions specified in Android manifest
Specify that Vulkan 1.1.0 is used if supported.

Remove explicit requirement of OpenGL ES 3.0 as OpenGL ES 1.0 is also supported as fallback and the client should pick the highest supported version.
2024-07-27 12:06:39 +02:00
Robert Müller 986508e091 Improve Android storage usage, faster launch, remove permissions
Split the user storage location and the data folder in the app specific external storage in the folders `data` and `user` instead of writing the user setting directly to the external storage.

Remove unnecessary storage permissions. The client only accesses files in its own external storage location, hence these permissions are not necessary for Android API 19 and higher, which is always given as we only target API 19 and higher.

Only unpack changed assets when their hash in the integrity index is different instead of unpacking all assets again, so the app starts faster after updates. Avoid unpacking the entire integrity index file unless it changed, by initially reading only the first hash directly from the asset, so the app starts faster when the data is up-to-date.

Add error handling for external storage not being accessible and other I/O errors during unpacking of assets.

Add `android_main.h` header to export the `InitAndroid` function and potentially other functions in the future. The `extern "C"` and `__attribute__((visibility("default")))` attributes seem to be unnecessary, as this function is only called directly from the native code like many other functions without these attributes.

Initialize the Android storage after the loggers, so the log message are printed properly.

Add documentation for the use of `std::exit` on Android, which is used to forcefully terminate the entire process, to ensure that static variables will be initialized correctly when the app is started again after quitting. Returning from the main function is not enough, as this only results in the native thread terminating, but the Java thread will continue. Java does not support unloading libraries once they have been loaded, so all static variables will not have their expected initial values anymore when the app is started again after quitting.

Use `fs_chdir` and `fs_makedir` instead of `chdir` and `mkdir`.
2024-05-25 21:09:42 +02:00
Robert Müller 51e4e41805 Change tw.DDNet package name to org.ddnet.client 2024-05-21 17:38:48 +02:00
Robert Müller 664b0e98bb Upgrade Gradle and fix Android deprecation errors
Upgrade to Gradle 8.5 and Gradle Plugin 8.3.0 for compatibility with Java 21. Explicity set Java version 21 in `build.gradle`. Increment compile and target SDK version to 34 accordingly.

Remove the explicitly defined, obsolete `buildToolsVersion` property in `build.gradle`, as it is now automatically derived by Gradle.

Replace the deprecated property `android:extractNativeLibs` in `AndroidMainfest.xml` with `useLegacyPackaging` in `build.gradle`.

Replace the deprecated package definition `package="tw.DDNet"` in `AndroidMainfest.xml` with `namespace("tw.DDNet")` in `build.gradle`.

Add the required property `android:exported="true"` to the main activity in `AndroidMainfest.xml`.
2024-05-21 17:38:42 +02:00
Robert Müller 05c825947a Force landscape orientation and hide title bar on Android
Always force landscape orientation to be used for the game on Android.

Hide the title bar so it is not shown when starting the game. There is also a bug with SDL currently that leads to the title bar and status bar being shown permanently after minimizing and reopening the app, which is alleviated by hiding the title bar.
2024-05-19 12:58:33 +02:00
Jupeyy b216b6744a Add Android build scripts 2021-08-24 12:18:20 +02:00