How projectmatris/antimalwareapp works
Main Components
• UI Layer: Represented by a set of Android Activities (e.g., MainActivity, ScanActivity, CustomScanActivity, AppDetails, HelpActivity, SettingsActivity, etc.), layouts, and adapters (AppsAdapter, AppsListAdapter, ScanResultAdapter). These handle user interaction, display results, and allow configuration.
• Scanning Module: This includes the scanners (e.g., ApkScanner, AppScanner, ScannerTask) which are responsible for extracting features (permissions and intents) from installed applications.
• Machine Learning Inference Module: The module that loads and runs the TensorFlow Lite model (present as saved_model.tflite in the assets folder) to produce a prediction score.
• Services and Receivers: Background services (like RealTimeService) and broadcast receivers (e.g., BootCompletedReceiver, AppListener) that help in monitoring changes such as system boot or app installs and trigger scans.
• Helper and Utility Components: Supporting classes (like ThemeToggleHelper, AppConstants, Sha256HashExtractor) that manage supplementary logic and configuration.
• Data Model: Classes (like AppInfo) that represent the application data, which is used both for scanning results and UI population.
• External Integration: Although not part of the runtime architecture, note that CI/CD workflows (.github/workflows), build configurations (Gradle scripts), and external credits indicate integration with upstream machine learning model repositories and external libraries (like AboutLibraries).
Relationships and Interactions
• The UI Layer initiates actions (e.g., a manual scan via ScanActivity). This request is forwarded to the Scanning Module.
• The Scanning Module uses multiple scanners to extract features from each installed application. It then consolidates these into a feature vector.
• The extracted features are passed on to the ML Inference Module, which loads the TensorFlow Lite model and returns a prediction score that defines the classification (Goodware, Risky, Malware, or Unknown).
• Results are then propagated back to the UI, where they are displayed through various adapters and activities.
• Background components (RealTimeService and BroadcastReceivers) run continuously to monitor system events, triggering scans as needed (e.g., on device boot or on installation of a new app).
• Helper utilities provide cross-cutting functionalities (e.g., toggling themes, computing hashes) that assist the main modules.
Architectural Patterns and Design Principles
• Separation of Concerns: UI, scanning/inference logic, and background services are clearly separated.
• Event-Driven and Service-Oriented: With usage of Broadcast Receivers and background Services to trigger and handle scans reliably.
• Modular Design: Different Java packages (activities, scanners, adapters, data, services, helper, etc.) support maintainability and allow parallel development.
Relevant Technologies and Frameworks
• Android Framework (Activity lifecycle, layouts, services, BroadcastReceivers)
• TensorFlow Lite (on-device ML inference using saved_model.tflite)
• Gradle (build configuration and dependency management)
• External Libraries: For example, AboutLibraries for displaying open-source attributions.
• CI/CD tools (GitHub Actions configured via workflows) for automated testing/building.
• Rectangles for UI components and services.
• Oval or parallelograms for data models.
Capturing Essential Architectural Elements
• UI Layer (listing out primary activities and interaction flows)
• Background Processing (comprising RealTimeService and Receivers)
• Core Scanning Logic (Scanners, feature extractors)
• ML Inference Engine (model loader and predictor)
• Supporting utilities (helpers and configuration constants)
• Data flow: user action triggers scan → feature extraction → ML inference → results update the UI.