Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ To maintain engineering transparency, the architectural reality of the repositor
| :--- | :--- | :--- |
| **Gradle Modules** | Single monolithic `:app` module containing all layers | Multi-module separation (`:core`, `:flashers`, `:app`) |
| **Package Namespace** | `com.ashishsinghbora.flashcore.*` across all source packages | Multi-module package organization |
| **Testing Scope** | 109 automated software tests on `BlockDevice` doubles | Automated CI + physical USB controller test matrix |
| **Testing Scope** | 225 automated software tests on `BlockDevice` doubles | Automated CI + physical USB controller test matrix |
| **USB Memory Pipeline** | Direct-buffer circular ring buffer with heap staging copy | Direct ring buffer (true zero-copy is not possible via public Android APIs; requires staging copy) |
| **Hardware Status** | Software tested; hardware validation pending | Physical qualification across OEM and controller matrix |

Expand Down
7 changes: 4 additions & 3 deletions LIMITATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ FlashCore is an open-source Android utility designed to communicate directly wit

All automated test verification in FlashCore is conducted strictly in **software-only environments** using pure JVM unit tests, Robolectric Android runtime simulations, and in-memory or file-backed storage abstractions.

### Automated Test Inventory (110 Tests Total)
* **109 Unit & Robolectric Tests (`app/src/test`):**
### Automated Test Inventory (226 Tests Total)
* **225 Unit & Robolectric Tests (`app/src/test`):**
- `MemoryBlockDeviceTest.kt` (38 tests): Validates in-memory block device geometry, overflow-safe bounds, multi-sector atomic allocation preflight, strict direct-buffer validation, defensive copying, concurrency under `CyclicBarrier` contention, and property round-trip fidelity.
- `BlockDeviceFrameworkTest.kt` (28 tests): Validates sector reads, writes, GPT headers, FAT32 boot records, 100 MB throughput simulation, 4 GB sparse boundaries, sector failure injection, disconnect simulation, short write simulation, timeout simulation, configurable sector sizes (512/4096B), multi-sector transfers with buffer offsets, auto-capacity detection, strict LBA/overflow bounds checking, direct buffer validation, sparse zero-fill reads, closed device lifecycle, independent MBR/GPT structural and CRC32 verification, concurrent operations and close races, and constructor descriptor leak prevention.
- `AndroidProductionEngineeringTest.kt` (10 tests): Validates foreground service lifecycle, cancellation action dispatch, `SavedStateHandle` restoration across process recreation, dynamic USB detachment broadcast handling, SAF 64-bit integer arithmetic, and synthetic 50 MB benchmark scaling.
- `Fat32WriterTest.kt` (9 tests): Validates volume formatting, VBR/FSInfo boot sectors, directory creation (`mkdir`), multi-cluster file writes, cluster appending, directory expansion, Long File Names (LFN), and FSInfo free cluster tracking.
- `PartitionEngineTest.kt` (9 tests): Validates MBR construction, Protective MBR generation, GPT table generation, dynamic CRC32 computation, round-trip GPT parsing, tamper detection, mixed-endian GUID conversions, and 1 MiB alignment arithmetic.
- `PartitionEngineTest.kt` (10 tests): Validates MBR construction, Protective MBR generation, GPT table generation, dynamic CRC32 computation, round-trip GPT parsing, tamper detection, mixed-endian GUID conversions, 1 MiB alignment arithmetic, and MBR device write with round-trip parsing on `MemoryBlockDevice`.
- `LinuxFlashingPipelineTest.kt` (8 tests): Validates end-to-end raw streaming, target capacity verification, write-protect detection, partition wipe warnings, destructive write confirmation, source checksum pre-flight validation, read-back sector corruption detection, and cooperative cancellation.
- `WindowsUefiPipelineTest.kt` (8 tests): Validates x64/ARM64/dual-arch Windows ISO capability detection, FAT32 cluster slack and capacity analysis, `WimChunker` SWM header creation, bootloader provisioning (`bootx64.efi`), PE `MZ` and registry `regf` header inspection, and end-to-end pipeline execution on in-memory storage.
- `VentoyPipelineTest.kt` (9 tests): Validates MBR and GPT Ventoy geometry calculations (Partition 1 data + Partition 2 32 MiB VTOYEFI), default asset provider generation, existing media detection, ISO listing in `/ISO/`, fresh install, and non-destructive update preserving user ISO files.
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Platform](https://img.shields.io/badge/Platform-Android_8.0+-green.svg)](https://developer.android.com)
[![JDK](https://img.shields.io/badge/JDK-21-red.svg)](https://adoptium.net)
[![Kotlin](https://img.shields.io/badge/Kotlin-2.2+-purple.svg)](https://kotlinlang.org)
[![Tests](https://img.shields.io/badge/Tests-110%20Automated%20Test%20Methods-blue.svg)]()
[![Tests](https://img.shields.io/badge/Tests-226%20Automated%20Test%20Methods-blue.svg)]()
[![Hardware Validation](https://img.shields.io/badge/Hardware%20Validation-Pending-yellow.svg)](LIMITATIONS.md)
[![Documentation](https://img.shields.io/badge/Docs-Architecture%20%7C%20Limitations-orange.svg)](ARCHITECTURE.md)

Expand All @@ -27,7 +27,7 @@ Our guiding principle is **engineering truthfulness**:
### Engineering Priorities & Baseline Reality
1. 🥇 **Correctness:** Bit-for-bit exactness in sector writing and verification logic.
2. 🥈 **Safety:** Hardened disconnect handling (`ACTION_USB_DEVICE_DETACHED`) and target drive safety checks.
3. 🥉 **Testability:** Core logic is decoupled from Android hardware APIs and covered by 187 automated tests (186 unit/Robolectric in JVM + 1 Android instrumentation test) on abstract `BlockDevice` doubles.
3. 🥉 **Testability:** Core logic is decoupled from Android hardware APIs and covered by 226 automated tests (225 unit/Robolectric in JVM + 1 Android instrumentation test) on abstract `BlockDevice` doubles.
4. **USB Reliability:** SCSI BOT stall recovery routines, clear-halt, and reset recovery (physical controller compatibility matrix pending).
5. **Block-Device Abstraction:** Zero coupling between UI/engines and Android hardware APIs.
6. **Partition Correctness:** Strict GPT/MBR alignment, CRC32 checks, and protective structures.
Expand Down Expand Up @@ -99,7 +99,7 @@ For complete technical specifications, review [`ARCHITECTURE.md`](ARCHITECTURE.m
| **Block Device Test Framework** | Implemented | 37 unit tests in `BlockDeviceFrameworkTest` | N/A (Software Test Double) | 🟢 **Implemented — software tested** | In-memory sparse, file-backed, and fault-injecting simulation; does not emulate physical controller hangs, power drops, or bus resets | [`BlockDevice.kt`](app/src/main/java/com/example/block/BlockDevice.kt), [`BlockDeviceFrameworkTest.kt`](app/src/test/java/com/example/BlockDeviceFrameworkTest.kt) |
| **FAT32 Filesystem Writer** | Implemented | 9 unit tests in `Fat32WriterTest` | Not validated | 🟢 **Implemented — software tested** | Custom minimal FAT32 engine; lacks fsck/repair; cluster allocation not validated against physical OS mount drivers | [`Fat32Writer.kt`](app/src/main/java/com/example/fat32/Fat32Writer.kt), [`Fat32WriterTest.kt`](app/src/test/java/com/example/Fat32WriterTest.kt) |
| **ISO Filesystem Engine** | Implemented | 6 unit tests in `IsoEngineTest` & `IsoFilesystemReaderTest` | N/A (Software Parser) | 🟢 **Implemented — software tested** | Supports ISO 9660 Level 1/2/3 and Joliet; no Rock Ridge POSIX permissions or pure UDF 2.60 support | [`IsoFilesystemReader.kt`](app/src/main/java/com/example/iso/IsoFilesystemReader.kt), [`IsoEngineTest.kt`](app/src/test/java/com/example/IsoEngineTest.kt) |
| **Partition Subsystem** | Implemented | 9 unit tests in `PartitionEngineTest` | Not validated | 🟢 **Implemented — software tested** | MBR and GPT layout generation verified in memory; partition table detection not validated on physical drives | [`PartitionEngine.kt`](app/src/main/java/com/example/partition/PartitionEngine.kt), [`PartitionEngineTest.kt`](app/src/test/java/com/example/PartitionEngineTest.kt) |
| **Partition Subsystem** | Implemented | 10 unit tests in `PartitionEngineTest` | Not validated | 🟢 **Implemented — software tested** | MBR and GPT layout generation verified in memory; partition table detection not validated on physical drives | [`PartitionEngine.kt`](app/src/main/java/com/example/partition/PartitionEngine.kt), [`PartitionEngineTest.kt`](app/src/test/java/com/example/PartitionEngineTest.kt) |
| **Android Production Engineering** | Implemented | 10 Robolectric tests in `AndroidProductionEngineeringTest` | Not validated | 🟡 **Implemented — hardware validation pending** | Foreground service and wake lock tested via Robolectric; synthetic benchmark/scalability harness; physical flash-drive performance and thermal telemetry not validated | [`FlashForegroundService.kt`](app/src/main/java/com/example/service/FlashForegroundService.kt), [`AndroidProductionEngineeringTest.kt`](app/src/test/java/com/example/AndroidProductionEngineeringTest.kt) |
| **SPSC Direct Ring Buffer** | Implemented | 2 unit tests in `FlashCoreUnitTest` | Not validated | 🟢 **Implemented — software tested** | Off-heap direct buffers reduce GC churn, but USB transfer path still includes a heap staging copy (not zero-copy); uses ReentrantLock | [`DirectRingBuffer.kt`](app/src/main/java/com/example/dsa/DirectRingBuffer.kt), [`FlashCoreUnitTest.kt`](app/src/test/java/com/example/FlashCoreUnitTest.kt) |
| **CI & Release Infrastructure** | Workflows configured | Configured in `.github/workflows` | Not validated | 🟡 **Configured — no published releases** | GitHub Actions workflows configured for lint, test, and signing; no official release tags or published APKs exist yet | [`.github/workflows/ci.yml`](.github/workflows/ci.yml), [`.github/workflows/release.yml`](.github/workflows/release.yml) |
Expand Down Expand Up @@ -161,7 +161,7 @@ When building in an environment configured with JDK 21 and Android SDK:
# 1. Run Android Lint
./gradlew lint

# 2. Run automated test suite (186 JVM/Robolectric unit tests)
# 2. Run automated test suite (225 JVM/Robolectric unit tests)
./gradlew test

# 3. Assemble Debug APK
Expand All @@ -172,8 +172,8 @@ When building in an environment configured with JDK 21 and Android SDK:
```

### Automated Test Suite Details
The repository contains **187 automated test methods** across 18 test files:
- **186 Unit & Robolectric tests** in `app/src/test` (across 17 test files): Covering block device doubles, USB bulk transfer length validation, SCSI BOT driver protocol, SCSI CDB construction, SCSI CHECK CONDITION and REQUEST SENSE sense data parsing, FAT32 formatting/allocation, ISO 9660 parsing, GPT/MBR partition engines, Linux/Windows/Ventoy strategies, and foreground service lifecycle.
The repository contains **226 automated test methods** across 19 test files:
- **225 Unit & Robolectric tests** in `app/src/test` (across 18 test files): Covering block device doubles, in-memory block devices (`MemoryBlockDevice`), USB bulk transfer length validation, SCSI BOT driver protocol, SCSI CDB construction, SCSI CHECK CONDITION and REQUEST SENSE sense data parsing, FAT32 formatting/allocation, ISO 9660 parsing, GPT/MBR partition engines, Linux/Windows/Ventoy strategies, and foreground service lifecycle.
- **1 Instrumentation test** in `app/src/androidTest`: Context verification (`ExampleInstrumentedTest.kt`).
- **Physical Hardware Tests:** 0. (All tests run against mock/in-memory abstractions; physical USB hardware and PC boot testing are not automated in CI).

Expand Down
Loading
Loading