Skip to content

Conversation

@hcaldicott
Copy link

Hi team,

Submitting a PR here in preparation for some upcoming features I'm planning to implement. I've started working on an accessibility service and enhanced MDM configurability.

A lot of what I'll be implementing extends on the wonderful work by @manfred-mueller in #40, but I wanted to submit an initial PR to tidy up a lot of the warnings and other deprications being thrown when building prior to making any significant changes.

While I have done my best to test the agent since these changes, I would love other contributors to provide feedback as I only have a limited fleet of test devices.

Key Changes

  1. Modernized build tooling & dependencies

    • Switched to Kotlin 2.3, AGP 8.13, Gradle 8.13, and added jitpack for third-party artifacts.
    • Enabled explicit assignment syntax in Gradle files, registered the clean task with the newer API, and surfaced Gradle warnings and lint checks.
    • Updated app module settings (namespace, build config feature, Java compatibility) and dependency versions (code-scanner, dexter, okhttp, Firebase libraries) to keep the project aligned with current Android tooling.
  2. Refined Kotlin code style and resources

    • Replaced redundant semicolons, var usages for immutable values, and deprecated toUpperCase() calls with Kotlin idioms and added _ markers for unused lambda parameters.
    • Fixed typos/resource accuracy by correcting invalid_server_pairing_link and centralizing the zero_string resource (which might be a little overkill, but hey)
    • Updating fragment_auth.xml constraints to remove hard-coded layout ties which were throwing errors and instead used parent references (this is one thing that might require more testing/feedback).
  3. Addressed build warnings and deprecated APIs

    • Migrated screen capture and intent-sender flows to the Activity Result API, including new launchers in MainActivity plus shared handling for pending file-deletion approvals (this is the most significant code change).
    • Hardened message handling (binary/text) in MeshAgent/MeshTunnel, improved null safety for sockets, and ensured notifications use NotificationCompat.
    • Updated ScreenCaptureService to use safer handler/parcelable handling and NotificationUtils to avoid deprecated notification fields.
  4. Additional runtime tweaks

    • Added stricter array/list handling across fragments and agent/tunnel logic to shield against null resources and outdated APIs (vibrator, camera, encryption helpers).
    • Introduced more defensive checks around battery updates, permission requests, toast displays, and user-interaction flows.

I welcome feedback from the team!

Harrison Caldicott added 2 commits December 18, 2025 17:03
This commit addresses several issues across the application, including dependency updates, code style modernization, and minor bug fixes.

**Build & Dependencies:**
- Updates the Gradle build scripts to use modern Groovy syntax with explicit assignment operators.
- Bumps the versions of several dependencies, including `okhttp`, `code-scanner`, and various AndroidX and Firebase libraries, to resolve potential bugs and improve stability.
- Updates the Gradle wrapper to a newer version more widely compatible with newer versions of Android Studio.
- Fixes and updates several other dependencies.

**Code Refinements:**
- Removes redundant semicolons throughout the Kotlin files to adhere to modern code style conventions.
- Replaces `var` with `val` for variables that are not reassigned, enhancing code immutability and safety.
- Modernizes string and character handling by replacing `toUpperCase()` with the idiomatic `uppercase()`.
- Unused parameters in lambdas and exception blocks are now correctly marked with an underscore (`_`).

**Bug Fixes:**
- Corrects a typo in the `invalid_server_pairing_link` string resource from "Linbk" to "Link".
- Addresses a hardcoded string by moving "000000" into a new `zero_string` resource in `strings.xml`.
- Suppresses a deprecation warning for the `vibrate()` method on older API levels to clean up build output.
- Improves null safety by using a safe cast (`as?`) when retrieving the `Vibrator` system service.
This commit addresses several build warnings.

**Build & Dependencies:**
- Update onActivityResult to more modern implementation.
@hcaldicott
Copy link
Author

N.B: This is a pre-req for the fun I'm having over here: https://github.com/hcaldicott/MeshCentralAndroidAgent/tree/remote-control

I have 80% completed the implementation of android remote control :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant