Skip to content
Merged
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
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,19 @@ jobs:
- name: Build pinned FreeSched 16 KiB AAR
run: ./scripts/build-freesched-aar.sh

- name: Run unit tests & assembleDebug
run: ./gradlew --no-daemon testDebugUnitTest assembleDebug
- name: Run unit tests, assembleDebug & bundleDebug (with :models_pack)
run: ./gradlew --no-daemon testDebugUnitTest assembleDebug bundleDebug

- name: Verify zero platform permissions in merged manifest & APK
run: ./scripts/check-zero-permissions.sh app/build/outputs/apk/debug/app-debug.apk

- name: Verify 16 KiB PT_LOAD 0x4000 & zipalign -P 16 on APK
run: ./scripts/check-16k-alignment.sh app/build/outputs/apk/debug/app-debug.apk

- name: Verify INT8 model packs in AAB (:models_pack) and debug APK
run: |
set -euo pipefail
unzip -l app/build/outputs/bundle/debug/app-debug.aab | grep -q "models_pack/assets/recall_models/dual_tower_int8.rcl1"
unzip -l app/build/outputs/bundle/debug/app-debug.aab | grep -q "models_pack/assets/recall_models/ocr_glyphs_int8.rcl1"
unzip -l app/build/outputs/apk/debug/app-debug.apk | grep -q "recall_models/dual_tower_int8.rcl1"
unzip -l app/build/outputs/apk/debug/app-debug.apk | grep -q "recall_models/ocr_glyphs_int8.rcl1"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local.properties
app/libs/*.aar
app/libs/*.jar
gradle/wrapper/gradle-wrapper.jar
models_pack/src/main/assets/recall_models/*.rcl1

# Compose Preview outputs
build/compose-preview/
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ Recall (`org.freesilicon.recall`) indexes and searches your screenshots locally
## Architecture

1. **Import & Dedupe (`ImportManager`, `Sha256Hasher`)** — Streams incoming URIs through SHA-256 deduplication and reserves a monotonic `import_generation` in SQLite.
2. **FreeSched Hardware Telemetry (`FreeSchedEngine`)** — Discovers NNAPI accelerators (`google-edgetpu`, `qti-htp`/`qti-dsp`, `mtk-neuron`/`mtk-mdla`) via `freesilicon/freesched` and reports honest active-backend telemetry (falling back to Vulkan GPU / CPU without faking NPU acceleration).
3. **Hybrid Store (`RecallDatabase`)** — Combines SQLite `fts5` (`bm25`) lexical search with quantized 512-d INT8 cosine similarity and normalized OCR bounding boxes.
4. **3-Screen Jetpack Compose UI** —
2. **Bundled INT8 Encoders & Zero-Permission OCR (`Int8DualTowerEncoder`, `BitmapOcrExtractor`, `:models_pack`)** — Play Asset Delivery install-time pack (`dual_tower_int8.rcl1` + `ocr_glyphs_int8.rcl1`, deterministically generated at build time by `scripts/export-int8-models.py`) provides 512-d INT8 dual-tower embeddings and light/dark-aware on-device OCR with normalized bounding boxes.
3. **FreeSched Hardware Telemetry & 8-Image Calibration (`FreeSchedEngine`)** — Discovers NNAPI accelerators (`google-edgetpu`, `qti-htp`/`qti-dsp`, `mtk-neuron`/`mtk-mdla`) via `freesilicon/freesched` and runs an apples-to-apples 8-image 2-layer FFN calibration (`64 -> 128 -> 64`) on CPU vs FreeSched AHB+NNAPI without faking NPU speedup on fallback.
4. **Hybrid Store (`RecallDatabase`)** — Combines SQLite `fts5` (`bm25`) lexical search with quantized 512-d INT8 cosine similarity and normalized OCR bounding boxes.
5. **3-Screen Jetpack Compose UI** —
- **Search Home:** Instant semantic + OCR search, matched snippet pills, masonry grid, and `+ Import` sheet.
- **Indexing & Benchmark Card:** Live batch telemetry + 1-tap dark-mode PNG **Hardware Card** exporter (zero personal screenshots included).
- **Indexing & Benchmark Card:** Live batch telemetry, 8-image calibration comparison, and 1-tap PNG **Hardware Card** exporter (zero personal screenshots included).
- **Result Detail & Crop Jump:** Pinch/pan zoom focused on matched OCR bounding boxes, `Copy`, `Share`, `Redact` (v1.1 hook), and atomic `Delete`.

## Build & Verify
Expand All @@ -28,8 +29,8 @@ Recall (`org.freesilicon.recall`) indexes and searches your screenshots locally
# 1. Sync pinned freesilicon/freesched (c795eed1) & build its 16 KiB arm64-v8a AAR
./scripts/build-freesched-aar.sh

# 2. Run JVM + Robolectric unit tests & assemble debug APK
./gradlew testDebugUnitTest assembleDebug
# 2. Run JVM + Robolectric unit tests, assemble debug APK & Play Asset Delivery AAB
./gradlew testDebugUnitTest assembleDebug bundleDebug

# 3. Verify zero platform permissions, 16 KiB ELF alignment, and clean-room boundaries
./scripts/check-zero-permissions.sh
Expand Down
25 changes: 24 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,29 @@ val ensureFreeSchedAar by tasks.registering(Exec::class) {
commandLine("bash", "scripts/build-freesched-aar.sh")
}

val exportInt8Models by tasks.registering(Exec::class) {
workingDir = rootProject.projectDir
commandLine("python3", "scripts/export-int8-models.py")
inputs.file(rootProject.file("scripts/export-int8-models.py"))
outputs.files(
rootProject.file("models_pack/src/main/assets/recall_models/dual_tower_int8.rcl1"),
rootProject.file("models_pack/src/main/assets/recall_models/ocr_glyphs_int8.rcl1"),
)
}

android {
namespace = "org.freesilicon.recall"
compileSdk = 35
assetPacks += listOf(":models_pack")

sourceSets {
getByName("debug") {
resources.srcDir(rootProject.file("models_pack/src/main/assets"))
}
getByName("test") {
resources.srcDir(rootProject.file("models_pack/src/main/assets"))
}
}

defaultConfig {
applicationId = "org.freesilicon.recall"
Expand Down Expand Up @@ -78,7 +98,10 @@ android {
}

tasks.named("preBuild").configure {
dependsOn(ensureFreeSchedAar)
dependsOn(ensureFreeSchedAar, exportInt8Models)
}
tasks.matching { it.name.contains("AssetPack", ignoreCase = true) }.configureEach {
dependsOn(exportInt8Models)
}

// Fail build if any unexpected uses-permission slips into the merged debug/release manifest.
Expand Down
Loading
Loading