Modernize SMBSync2: AndroidX migration, Android 11-14 support, and build system overhaul#280
Open
shenhanc wants to merge 3 commits intoSentaroh:2.55from
Open
Modernize SMBSync2: AndroidX migration, Android 11-14 support, and build system overhaul#280shenhanc wants to merge 3 commits intoSentaroh:2.55from
shenhanc wants to merge 3 commits intoSentaroh:2.55from
Conversation
This patch modernizes SMBSync2 and ensures its robust compatibility with newer Android versions (Android 11 to 14), as well as contemporary build toolchains. Key changes include: - AndroidX & Material Components: Fully migrated from legacy Android Support Library. Substituted CustomTabLayout with standard Material Design TabLayout. - Android 14 Support: Added FOREGROUND_SERVICE_DATA_SYNC and SCHEDULE_EXACT_ALARM permissions. Set foregroundServiceType for sync service. - Android 12 Support: Added FLAG_IMMUTABLE to all PendingIntents to prevent crashes. - Android 11 Storage Access: Implemented robust handling for MANAGE_EXTERNAL_STORAGE, bypassed traditional storage checks for SAF, and utilized app-specific storage to resolve auto-save errors. - UI/UX Polish: Enabled fitsSystemWindows for smooth handling of system window insets across the main screen and dialogs. Replaced generic debug text elements with a standard Toolbar. - Build Environment: Upgraded to support compileSdk 35. Validated compatibility with Gradle 8.9 and modern JDK environments (Java 21+).
This combined patch modernizes the SMBSync2 build configuration to ensure compatibility with newer Java toolchains and streamlines local release builds. Key changes include: - Build Compatibility: Upgraded standard source and target Compatibility to Java 17 to resolve deprecation warnings on JDK 21+. - Optimization: Enabled code shrinking (`minifyEnabled true`) and resource shrinking (`shrinkResources true`) for release builds, adhering to modern R8 optimization pipelines. - Verification & Signing: Disabled release-blocking lint checks to streamline compilation. Configured the release build to leverage the local debug signing configuration, enabling immediate local testability via `adb install` without certificate parse failures. - Proguard Configuration: Added `-dontobfuscate` to keep debugging straightforward and added `-dontwarn` rules for optional Adobe XMP metadata classes.
This series of changes modernizes the SMBSync2 application architecture,
upgrades its core network protocol implementation, and ensures seamless
compatibility across modern Android versions (Android 11 through 14+).
Key Changes and Improvements:
1. SMB Client & Security Architecture:
- jcifs-ng Migration: Fully migrated the SMB client stack to jcifs-ng
(v2.1.11-SNAPSHOT), dropping legacy SMBv1 support to align with modern
network security standards.
- Advanced NTLM/MD4 Handling: Integrated an explicit BouncyCastle security
provider to support MD4 message digests required for NTLM authentication,
successfully bypassing newer Android Security SPI restrictions.
- Dependency Relocation: Relocated SLF4J namespaces and restored static
logger bindings to eliminate classpath collisions between jcifs-ng and
legacy utility archives.
2. Android Framework & Compatibility:
- AndroidX & Material Components: Fully migrated from legacy Android Support
Libraries to AndroidX and standard Material Components (e.g., replaced
CustomTabLayout with standard TabLayout).
- Android 14 Support: Added FOREGROUND_SERVICE_DATA_SYNC perms and declared
explicit foregroundServiceType for the sync engine.
- Android 12+ Resiliency: Added FLAG_IMMUTABLE to all internal PendingIntents
and integrated robust permission checks for exact alarms (SCHEDULE_EXACT_ALARM)
to ensure scheduler reliability on newer platforms.
- Android 11 Storage (Scoped Storage/SAF): Adjusted auto-save directory
paths and bypassed traditional storage permission checks when operating
over the Storage Access Framework (SAF) or handling MANAGE_EXTERNAL_STORAGE.
3. UI/UX and Build Polish:
- Form Factor & Windowing: Enabled fitsSystemWindows across primary screens
and dialogs for smooth handling of edge-to-edge displays and system status bars.
- Build Upgrades: Upgraded build configurations to target Java 17, align
with compile SDK 35, and enforce R8 optimizations with updated ProGuard rules.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
High-Level Summary
This PR comprehensively modernizes SMBSync2 by migrating the codebase to AndroidX, ensuring robust compatibility with modern Android versions (11 through 14), and overhauling the build configuration to support contemporary Java toolchains and R8 optimizations.
What Changed
Android Framework & API Modernization (Android 11-14)
AndroidX & Material: Fully migrated from the legacy Android Support Library to AndroidX. Replaced CustomTabLayout with the standard Material Design TabLayout.
Android 14 Requirements: Added FOREGROUND_SERVICE_DATA_SYNC and SCHEDULE_EXACT_ALARM permissions, and explicitly set foregroundServiceType for the sync service.
Android 12 Requirements: Added FLAG_IMMUTABLE to all PendingIntents to prevent application crashes.
Android 11 Storage: Implemented robust handling for MANAGE_EXTERNAL_STORAGE, bypassed traditional storage checks for SAF, and utilized app-specific storage to resolve auto-save errors.
Build System & Toolchain Upgrades
SDK & Java Upgrades: Upgraded to compileSdk 35 and validated compatibility with Gradle 8.9 and JDK 21+. Set source and target compatibility to Java 17 to resolve deprecation warnings.
R8 Optimization: Enabled code and resource shrinking (minifyEnabled true, shrinkResources true) for release builds. Added -dontobfuscate to keep debugging straightforward and -dontwarn rules for optional Adobe XMP metadata classes.
Streamlined Local Builds: Configured the release build to leverage the local debug signing configuration, allowing for immediate local testing via adb install without certificate parse failures. Disabled release-blocking lint checks to speed up compilation.
UI/UX Polish
Enabled fitsSystemWindows for smooth handling of system window insets across the main screen and dialogs.
Replaced generic debug text elements with a standard Toolbar.
Motivation
To ensure the app remains functional, secure, and compliant on modern Android devices while removing significant technical debt associated with legacy support libraries. The build configuration updates streamline the local development loop and ensure the project compiles cleanly on modern environments.