347 Commits

Author SHA1 Message Date
Robert Bragg 1a8a92b3fb Merge pull request #99 from rust-mobile/release-0.4.3
Release 0.4.3
v0.4.3
2023-07-30 20:19:32 +01:00
Robert Bragg bb97af154f Release 0.4.3 2023-07-30 20:07:43 +01:00
Robert Bragg 8a21219695 Merge pull request #98 from rust-mobile/rib/pr/fix-game-activity-deadlock
GameActivity PATH: fix deadlocks in java callbacks after app destroyed
2023-07-30 19:51:23 +01:00
Robert Bragg c10a2fb67a GameActivity PATH: fix deadlocks in java callbacks after app destroyed
This ensures that any java Activity callbacks take into account the
possibility that the `android_app` may have already been marked
destroyed if `android_main` has returned - and so they mustn't block
and wait for a thread that is no longer running.
2023-07-30 19:38:50 +01:00
Robert Bragg ab2606a73d build.rs: emit rerun-if-changed lines for compiled C/C++ code 2023-07-30 19:38:50 +01:00
Robert Bragg a84a7b54cd Merge pull request #94 from sagebind/fix-deadlock-on-ondestroy
Fix deadlock on activity onDestroy
2023-07-30 16:01:31 +01:00
Stephen M. Coakley a9e91f4308 Fix deadlock on activity onDestroy
Fix a deadlock that occurs when an activity is destroyed without process
termination, such as when an activity is destroyed and recreated due to
a configuration change.

The deadlock occurs because `notify_destroyed` blocks until `destroyed`
is set to `true`. This only occurs when `WaitableNativeActivityState` is
dropped, but the `WaitableNativeActivityState` instance is the very
thing being used to await for destruction, resulting in a deadlock.

Instead of waiting for the `WaitableNativeActivityState` to be dropped
we now wait until the native `android_main` thread has stopped.

So we can tell the difference between the thread not running because it
hasn't started or because it has finished (in case `android_main`
returns immediately) this replaces the `running` boolean with a
tri-state enum.

Co-authored-by: Robert Bragg <robert@sixbynine.org>
2023-07-21 20:02:13 +01:00
Robert Bragg 0f00a58a41 Merge pull request #90 from rust-mobile/release-0.4.2
Release 0.4.2
v0.4.2
2023-06-27 17:39:52 +01:00
Robert Bragg 9a713c823d Release 0.4.2 2023-06-27 17:19:52 +01:00
Robert Bragg 230035526b Update na-mainloop 2023-06-26 00:08:48 +01:00
Robert Bragg cd81420638 Update agdk-mainloop 2023-06-26 00:08:42 +01:00
Robert Bragg 1ad3abd934 Merge pull request #87 from rust-mobile/rust-version
cargo: Fix `rust_version` -> `rust-version` property typo
2023-06-25 21:38:48 +01:00
Marijn Suijten ca0d2eb3aa cargo: Fix rust_version -> rust-version property typo
Cargo complains:

    warning: android-activity/Cargo.toml: unused manifest key: package.rust_version

Solve this by replacing the underscore with a hyphen.
2023-06-24 00:43:14 +02:00
Robert Bragg 79e03e08fb Merge pull request #81 from rib/finish-activity
Call Activity.finish() when android_main returns
2023-06-19 21:05:41 +01:00
Robert Bragg 120d2f66c7 Merge pull request #86 from rust-mobile/readme-badges
README: Add badges to CI, crates.io, docs.rs and show the MSRV
2023-06-16 19:34:51 +01:00
Marijn Suijten 4a4efd871a README: Add badges to CI, crates.io, docs.rs and show the MSRV
I was trying to quickly get to the documentation of this crate and had
the GitHub page open... but there was no link on the front-page: let's
fix that.
2023-06-16 17:37:41 +02:00
Robert Bragg 3843a7cfaa Call Activity.finish() when android_main returns
Calling Activity.finish() is what ensures the Activity will get
gracefully destroyed, including calling the Activity's onDestroy
method.

Fixes: #67
2023-05-24 23:10:29 +01:00
Robert Bragg 924e5405c2 Merge pull request #84 from yunsash/pointer_index_fix
game_activity: Fix `pointer_index()` always returning `0`
2023-05-24 22:39:49 +01:00
kukie 049e660219 fix: pointer_index always returns 0 2023-05-23 15:43:03 +03:00
Robert Bragg 6559dc8133 Merge pull request #68 from notgull/abort-guards
Add panic guards to extern "C" functions
2023-04-27 20:55:55 +01:00
jtnunley d6ccefaf77 Add catch unwind wrappers to extern "C" functions
Co-authored-by: Robert Bragg <robert@sixbynine.org>
2023-04-27 20:42:45 +01:00
Robert Bragg 9229bb20c1 Merge pull request #77 from rib/rust-version-0-64-typo
Fix rust_version typo s/0.64/1.64/
2023-04-24 16:12:08 +01:00
Robert Bragg 4976cbad44 Fix rust_version typo s/0.64/1.64/
Also removes a stale comment about MSVR policy in ci.yml
2023-04-24 11:42:17 +01:00
jtnunley e0c96ad6b4 Dedup android_log 2023-04-24 11:36:27 +01:00
Robert Bragg c70e5d852f Merge pull request #73 from rust-mobile/dependabot/github_actions/actions/checkout-3
build(deps): bump actions/checkout from 2 to 3
2023-04-23 20:00:03 +01:00
Robert Bragg f28d6adc55 Merge pull request #74 from rust-mobile/dependabot/cargo/num_enum-0.6
build(deps): update num_enum requirement from 0.5 to 0.6
2023-04-23 19:59:50 +01:00
dependabot[bot] 0fa6888484 build(deps): update num_enum requirement from 0.5 to 0.6
Updates the requirements on [num_enum](https://github.com/illicitonion/num_enum) to permit the latest version.
- [Release notes](https://github.com/illicitonion/num_enum/releases)
- [Commits](https://github.com/illicitonion/num_enum/compare/0.5.0...0.6.1)

---
updated-dependencies:
- dependency-name: num_enum
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-23 15:14:30 +00:00
dependabot[bot] d4a3d5845d build(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-23 15:11:09 +00:00
Robert Bragg c91745a39d Merge pull request #76 from rib/cargo-ndk-2-for-ci
Add MSRV policy to README and bump `rust_version` to 0.64, due to `ndk` -> `raw_window_handle` dependency
2023-04-23 16:10:34 +01:00
Robert Bragg 1b44d38822 Bump MSRV to 0.64 and and MSRV policy to README 2023-04-23 15:57:07 +01:00
Robert Bragg 9ac7891664 CI: test with cargo-ndk 2, which compiles with rustc 1.60 2023-04-22 17:37:55 +01:00
Robert Bragg 03b06b8c5e Merge pull request #70 from MarijnS95/na-resize
native-activity: Propagate `NativeWindow` redraw/resize and `ContentRectChanged` callbacks to main loop
2023-04-19 13:44:52 +01:00
Robert Bragg caf2a624b2 Merge pull request #72 from notgull/dependabot
Add dependabot support
2023-04-19 13:41:41 +01:00
Marijn Suijten fe9d68c99e Clean up partial module imports
Some items were imported in scope while most of the code uses fully
qualified names.
2023-04-19 14:09:39 +02:00
Marijn Suijten 0c3f16c9ba native-activity: Propagate onContentRectChanged callback to main loop 2023-04-19 14:09:30 +02:00
Marijn Suijten 87fe6a8465 native-activity: Propagate onNativeWindowRedrawNeeded callback to main loop 2023-04-19 14:09:24 +02:00
Marijn Suijten a04c483d79 native-activity: Propagate onNativeWindowResized callback to main loop 2023-04-19 14:09:12 +02:00
jtnunley 507cfe072e Add dependabot support 2023-04-10 09:45:05 -07:00
Robert Bragg 36ddfaa9ce Merge pull request #64 from rib/release-0.4.1
Release 0.4.1
v0.4.1
2023-02-15 15:38:40 +00:00
Robert Bragg b2467cb028 Release 0.4.1 2023-02-15 14:28:55 +00:00
Robert Bragg 6dd3c0c02a Merge pull request #62 from rib/rust-mobile-org-urls
Update Github URL since moving to rust-mobile org
2023-02-14 12:02:18 +00:00
Robert Bragg 6ae2e427d6 Merge pull request #61 from rib/jni-vm-and-activity-ptrs
Add AndroidApp::vm_as_ptr() and ::activity_as_ptr() APIs
2023-02-14 12:01:33 +00:00
Robert Bragg dc9ca832c5 Add AndroidApp::vm_as_ptr() and ::activity_as_ptr() APIs
This enables applications to make JNI calls without needing the
`ndk-context` crate - which we would like to deprecate.

Fixes: #60
2023-02-14 11:49:38 +00:00
Robert Bragg 9d06f62a4e Update Github URL since moving to rust-mobile org 2023-02-13 17:20:11 +00:00
Robert Bragg 6942637c3c Merge pull request #56 from rib/remove-example-lock-files
Remove Cargo.lock files for examples
2022-12-23 01:25:51 +00:00
Robert Bragg 47b2e279e0 Remove Cargo.lock files for examples
When splitting out the rust-android-examples we kept the agdk-mainloop
and na-mainloop examples in part so we would have some simple code we
can build as integration tests.

Since it's less likely that these will be referenced directly as
examples now, compared to those in rust-android-examples this removes
the lock files so we will instead always build against the latest semver
compatible dependencies.

Considering the simplicity of these examples, and minimal dependencies
these lock files probably weren't that worthwhile before either.
2022-12-23 01:00:57 +00:00
Robert Bragg 40fb012000 Merge pull request #52 from rib/update-readme-example-links
README: update example links
2022-12-21 23:28:48 +00:00
Robert Bragg 4155fbc9db README: update example links 2022-12-21 23:27:09 +00:00
Robert Bragg 435e183a58 Merge pull request #50 from rib/remove-most-examples
Remove most examples (see https://github.com/rust-mobile/rust-android-examples)
2022-12-21 16:15:30 +00:00
Robert Bragg 2e279210a3 Remove most examples
Most of the examples weren't strictly just demonstrating how to use the
android-activity API - rather they demonstrated using other libraries
in conjunction with android-activity.

Most of the examples have now been split into a standalone repository
under: https://github.com/rust-mobile/rust-android-examples

The na-mainloop and agdk-mainloop examples have been kept here since
they can be built against the local/in-tree version of android-activity
and are useful to keep for CI purposes.

This also runs `cargo update` for the na-mainloop and agdk-mainloop.
2022-12-20 19:55:10 +00:00