Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pure rust native activity backend #35

Merged
merged 12 commits into from
Oct 11, 2022
Merged

Pure rust native activity backend #35

merged 12 commits into from
Oct 11, 2022

Commits on Oct 8, 2022

  1. native-activity: Migrate ANativeActivity callbacks to Rust

    A first step towards replacing the android_native_app_glue code with a
    pure Rust implementation.
    rib committed Oct 8, 2022
    Configuration menu
    Copy the full SHA
    2d44950 View commit details
    Browse the repository at this point in the history
  2. native-activity: Port android_app_create/free from C to Rust

    A literal port for now, with the intention of re-working into more
    idiomatic Rust code once we have a port of all the C code.
    rib committed Oct 8, 2022
    Configuration menu
    Copy the full SHA
    a657294 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1314210 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1507b37 View commit details
    Browse the repository at this point in the history
  5. native-activity: complete (first-pass) port of C code to Rust

    At this point the C code has been fully ported to Rust but it's not yet
    well integrated with the pre-existing Rust code and the port is not yet
    particularly idiomatic Rust code.
    rib committed Oct 8, 2022
    Configuration menu
    Copy the full SHA
    3de1433 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    2870a84 View commit details
    Browse the repository at this point in the history
  7. native-activity: re-work ported glue code into idiomatic Rust

    This is a fairly thorough re-working of all the code that was initially
    naively ported from android_native_app_glue.c to be more idiomatic Rust
    code (though by it's nature it still involves a lot of unsafe code)
    
    Most of the glue code now lives in src/native_activity/glue.rs as part
    of a NativeActivityGlue API
    
    The design as far as the threading model, IPC and synchronization goes
    is unchanged.
    rib committed Oct 8, 2022
    Configuration menu
    Copy the full SHA
    cd32b4a View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2022

  1. Configuration menu
    Copy the full SHA
    879d7ca View commit details
    Browse the repository at this point in the history
  2. native-activity: fix Weak ref from_raw + upgrade + into_raw handling …

    …for callbacks
    
    This adds a common `try_with_waitable_activity_ref` utility that handles
    upgrading the Weak reference associated with `ANativeActivity` whenever
    we get an activity callback.
    
    Previously we weren't converting the Weak reference back to a pointer
    before returning from the callback which would result in us dropping the
    Weak reference after the first callback.
    rib committed Oct 11, 2022
    Configuration menu
    Copy the full SHA
    949386e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2e25e2e View commit details
    Browse the repository at this point in the history
  4. native-activity: track saved state as a Vec<u8>

    This simplifies the tracking of saved state by simply using a Vec and
    only copying into a `malloc()` allocation when passing the saved state
    to `ANativeActivity`.
    
    This also ensures saved state persists (in Rust) between a
    `MainEvent::SaveState` event and a `Resume` event - otherwise the saved
    state would only be restored in the situation where `onCreate` is called
    again for a new process.
    rib committed Oct 11, 2022
    Configuration menu
    Copy the full SHA
    1ed7d38 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c3d115f View commit details
    Browse the repository at this point in the history