Skip to content

fix: Device info activity crash on optimized build#298

Merged
sameerasw merged 1 commit intomainfrom
develop
Mar 25, 2026
Merged

fix: Device info activity crash on optimized build#298
sameerasw merged 1 commit intomainfrom
develop

Conversation

@sameerasw
Copy link
Owner

This pull request standardizes the serialization and deserialization of data models throughout the codebase by adding @Keep and @SerializedName annotations to all relevant data classes and enums. These changes ensure that fields are preserved during code shrinking/obfuscation and that JSON keys are correctly mapped to Kotlin properties, improving reliability when working with Gson or similar serialization libraries.

Key changes include:

Serialization/Deserialization Enhancements:

  • Added @SerializedName annotations to all fields in data classes and enums in the following files, ensuring explicit mapping between JSON keys and Kotlin properties:
    • DeviceSpecs.kt, Automation.kt, AppSelection.kt, DnsPreset.kt, LocationAlarm.kt, MapsChannel.kt, SnoozeChannel.kt, TrackedRepo.kt, UpdateInfo.kt, GitHubModels.kt, GitHubUser.kt [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
  • Updated enums and nested data classes to use @SerializedName for each value, ensuring proper serialization of enum values (e.g., Automation.Type, Action.SoundModeType) [1] [2].

Obfuscation and Code Shrinking Safeguards:

  • Added @Keep annotation to all major data classes, enums, and sealed interfaces to prevent their removal or renaming during code shrinking (ProGuard/R8), which is critical for reflection-based serialization/deserialization (All references above, especially [1] [2] [3].

Domain Model Consistency:

  • Ensured all domain models related to device automation, GitHub integration, and user settings are now consistently annotated for serialization, reducing the risk of runtime errors and improving maintainability [1] [2] [3] [4].

Sealed Interface Updates:

  • Applied @Keep and @SerializedName to sealed interface implementations (objects, data classes) for Action, State, and Trigger, making sure all automation logic components are serialization-safe [1] [2] [3] [4].

These changes collectively make the codebase more robust and ready for safe serialization/deserialization, especially in environments where code shrinking or obfuscation is enabled.

@sameerasw sameerasw self-assigned this Mar 25, 2026
@sameerasw sameerasw added the bug Something isn't working label Mar 25, 2026
@sameerasw sameerasw merged commit ca5e018 into main Mar 25, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Essentials Progress Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant