Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / photos / AGENTS.md
| 1 | # AGENTS.md — photos/ (':photos') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `photos/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | _Install: ./install photos (dev by default)._ |
| 6 | <!-- last-reviewed: 2026-10-16 --> |
| 7 | - Gradle: :photos / dir: photos/ |
| 8 | - Package roots present: ui, data, domain, platform, service |
| 9 | - Entry files: MainActivity.kt (no Route.kt — `Route` + `Navigation` are inline) |
| 10 | - Deps: :library:map, :library:image, :library:ml, :library:room, :library:ink, :library:widgets, :library:biometric, :library:ocr, :library:downloadservice |
| 11 | - Metadata: metadata_data/photos.md (present) |
| 12 | - Rust: yes / screenshotTest: yes |
| 13 | |
| 14 | ## Overview |
| 15 | **Purpose:** A photos app with a full non-destructive editor and on-device AI search — faces, text, and content all indexed locally. Internet only for basemap tiles behind the map view. |
| 16 | **Key features:** |
| 17 | - Gallery with adjustable grid, albums, people (on-device face grouping), map view, trash, and separate photo/video editors (`EditActivity`/`VideoEditActivity`) |
| 18 | - Non-destructive editor: curves, HSL, levels, healing, liquify, layers, selective edits, undo/redo — edits stored as `data/*Data` docs, composited by `LayerCompositor` |
| 19 | - On-device search by content (CLIP), by text (OCR layout), and by person (face recognition + segmentation); biometric-locked secure folder with optional relock-on-exit |
| 20 | - Wallpaper/live-wallpaper, Glance home widget, motion-photo support, and background sync worker |
| 21 | **Architecture / data-flow:** `ui/` pages over `util/` ViewModels (`GalleryViewModel`, `PhotoEditViewModel`, `VideoEditViewModel`, `PhotoMapViewModel`, `SecureFolderViewModel`) → `data/` Room (`PhotoDatabase`, `VaultDatabase`, `PhotosRepository`/`VaultRepository`) plus MediaStore indexing (`AlbumMediaStore`); ML (faces, CLIP, OCR, segmentation) runs on `:library:ml` with a Rust native bridge (`PhotosNative`). `onCreateBeforeContent`: widget previews + `ImageLoader.init`; `Content()` provides the column-count state behind a media-permissions gate into inline `Navigation()`. |
| 22 | **Entry points + reading order:** `Route` (`Gallery` / `PhotoPage` / `Map` / `People` / `Albums` / `Trash` / `SecureFolder` / `VaultViewer` / `Wallpaper`, inline) → `MainActivity.kt` → `ui/GalleryPage.kt` → `util/GalleryViewModel.kt` → `data/PhotosRepository.kt`. |
| 23 | **Gotchas:** |
| 24 | - Re-tapping a photo replaces the viewer (`pushPhoto`/`setLast`) instead of stacking — don't `add()` photo routes or back steps through stale viewers |
| 25 | - `ACTION_VIEW` from another app (e.g. the camera) makes that one photo the stack root with no gallery beneath; in-app back handling must not swallow the system predictive-back gesture there |
| 26 | - `MaFragmentActivity` (not `MaActivity`) — biometric + fragment-hosting requirement |
| 27 | - Extra non-conforming dirs (`glance/`, `util/`) hold real code — closed-roots migration pending |
| 28 | |
| 29 | ## Key files |
| 30 | ### Root — entry + inline navigation |
| 31 | - com/vayunmathur/photos/MainActivity.kt — Route, Navigation, pushPhoto, relock logic |
| 32 | ### data/ — Room + edit-document model |
| 33 | - com/vayunmathur/photos/data/PhotosRepository.kt |
| 34 | - com/vayunmathur/photos/data/PhotoDatabase.kt |
| 35 | - com/vayunmathur/photos/data/Photo.kt |
| 36 | - com/vayunmathur/photos/data/VaultRepository.kt |
| 37 | - com/vayunmathur/photos/data/VaultDatabase.kt |
| 38 | - com/vayunmathur/photos/data/EditDocument.kt |
| 39 | - com/vayunmathur/photos/data/ImageAdjustments.kt |
| 40 | - com/vayunmathur/photos/data/FxAdjustments.kt |
| 41 | - com/vayunmathur/photos/data/MoreAdjustmentsData.kt |
| 42 | - com/vayunmathur/photos/data/LayerData.kt |
| 43 | - com/vayunmathur/photos/data/LayerBlendMode.kt |
| 44 | - com/vayunmathur/photos/data/CurvesData.kt |
| 45 | - com/vayunmathur/photos/data/LevelsData.kt |
| 46 | - com/vayunmathur/photos/data/HslData.kt |
| 47 | - com/vayunmathur/photos/data/ColorBalanceData.kt |
| 48 | - com/vayunmathur/photos/data/ChannelMixerData.kt |
| 49 | - com/vayunmathur/photos/data/BlackAndWhiteData.kt |
| 50 | - com/vayunmathur/photos/data/BlurData.kt |
| 51 | - com/vayunmathur/photos/data/SharpenData.kt |
| 52 | - com/vayunmathur/photos/data/NoiseData.kt |
| 53 | - com/vayunmathur/photos/data/HealingData.kt |
| 54 | - com/vayunmathur/photos/data/ContentAwareData.kt |
| 55 | - com/vayunmathur/photos/data/LiquifyData.kt |
| 56 | - com/vayunmathur/photos/data/DodgeBurnData.kt |
| 57 | - com/vayunmathur/photos/data/GradientMapData.kt |
| 58 | - com/vayunmathur/photos/data/StylizeData.kt |
| 59 | - com/vayunmathur/photos/data/PerspectiveData.kt |
| 60 | - com/vayunmathur/photos/data/SelectionData.kt |
| 61 | - com/vayunmathur/photos/data/SelectiveEditData.kt |
| 62 | - com/vayunmathur/photos/data/Drawing.kt |
| 63 | - com/vayunmathur/photos/data/PaintOpsData.kt |
| 64 | - com/vayunmathur/photos/data/SmudgeData.kt |
| 65 | - com/vayunmathur/photos/data/OcrLayout.kt |
| 66 | - com/vayunmathur/photos/data/FaceData.kt |
| 67 | - com/vayunmathur/photos/data/RedEyeData.kt |
| 68 | - com/vayunmathur/photos/data/VideoEditState.kt |
| 69 | - com/vayunmathur/photos/data/BitmapExtensions.kt |
| 70 | ### domain/ — OCR + motion-photo helpers (pure logic) |
| 71 | - com/vayunmathur/photos/domain/PhotoOcr.kt |
| 72 | - com/vayunmathur/photos/domain/MotionPhotoXmp.kt |
| 73 | ### glance/ — home widget |
| 74 | - com/vayunmathur/photos/glance/PhotoGlanceWidget.kt |
| 75 | - com/vayunmathur/photos/glance/PhotoGlanceWidgetReceiver.kt |
| 76 | ### platform/ — motion-photo + ET models |
| 77 | - com/vayunmathur/photos/platform/MotionPhotoVideo.kt |
| 78 | - com/vayunmathur/photos/platform/PhotosEtModels.kt |
| 79 | ### service/ — live wallpaper |
| 80 | - com/vayunmathur/photos/service/LiveWallpaperService.kt |
| 81 | ### ui/ — gallery, albums, people, map |
| 82 | - com/vayunmathur/photos/ui/GalleryPage.kt |
| 83 | - com/vayunmathur/photos/ui/GalleryScreen.kt |
| 84 | - com/vayunmathur/photos/ui/GalleryGrouping.kt |
| 85 | - com/vayunmathur/photos/ui/AlbumsPage.kt |
| 86 | - com/vayunmathur/photos/ui/AlbumsScreen.kt |
| 87 | - com/vayunmathur/photos/ui/AlbumDetailPage.kt |
| 88 | - com/vayunmathur/photos/ui/AlbumDetailScreen.kt |
| 89 | - com/vayunmathur/photos/ui/AlbumPickerDialog.kt |
| 90 | - com/vayunmathur/photos/ui/PeoplePage.kt |
| 91 | - com/vayunmathur/photos/ui/MapPage.kt |
| 92 | - com/vayunmathur/photos/ui/TrashPage.kt |
| 93 | - com/vayunmathur/photos/ui/ImageFit.kt |
| 94 | ### ui/ — viewer + metadata |
| 95 | - com/vayunmathur/photos/ui/PhotoPage.kt |
| 96 | - com/vayunmathur/photos/ui/PhotoDetailView.kt |
| 97 | - com/vayunmathur/photos/ui/PhotoDetailSection.kt |
| 98 | - com/vayunmathur/photos/ui/PhotoDetailMedia.kt |
| 99 | - com/vayunmathur/photos/ui/PhotoMetadataCard.kt |
| 100 | - com/vayunmathur/photos/ui/PhotoFilmstrip.kt |
| 101 | - com/vayunmathur/photos/ui/PhotoViewerActions.kt |
| 102 | - com/vayunmathur/photos/ui/PhotoViewerWideLayout.kt |
| 103 | - com/vayunmathur/photos/ui/PhotoZoomGestures.kt |
| 104 | - com/vayunmathur/photos/ui/EditRoute.kt |
| 105 | - com/vayunmathur/photos/ui/EditActivity.kt |
| 106 | - com/vayunmathur/photos/ui/FaceBoxLayer.kt |
| 107 | - com/vayunmathur/photos/ui/OcrTextLayer.kt |
| 108 | - com/vayunmathur/photos/ui/PanoramaFlatView.kt |
| 109 | - com/vayunmathur/photos/ui/PanoramaSphereView.kt |
| 110 | ### ui/ — editor panels + canvas |
| 111 | - com/vayunmathur/photos/ui/EditPhotoPage.kt |
| 112 | - com/vayunmathur/photos/ui/EditPhotoEditorState.kt |
| 113 | - com/vayunmathur/photos/ui/EditPhotoModels.kt |
| 114 | - com/vayunmathur/photos/ui/EditPhotoModelHelpers.kt |
| 115 | - com/vayunmathur/photos/ui/EditPhotoCanvas.kt |
| 116 | - com/vayunmathur/photos/ui/EditPhotoPanels.kt |
| 117 | - com/vayunmathur/photos/ui/EditPhotoActivePanel.kt |
| 118 | - com/vayunmathur/photos/ui/EditPhotoAdjustPanels.kt |
| 119 | - com/vayunmathur/photos/ui/EditPhotoBrushPanels.kt |
| 120 | - com/vayunmathur/photos/ui/EditPhotoSelectionPanels.kt |
| 121 | - com/vayunmathur/photos/ui/EditPhotoBottomControls.kt |
| 122 | - com/vayunmathur/photos/ui/EditPhotoCropOverlay.kt |
| 123 | - com/vayunmathur/photos/ui/EditPhotoToolOverlays.kt |
| 124 | - com/vayunmathur/photos/ui/EditPhotoModeEffect.kt |
| 125 | - com/vayunmathur/photos/ui/EditPhotoTextDialog.kt |
| 126 | - com/vayunmathur/photos/ui/AdvancedPanels.kt |
| 127 | - com/vayunmathur/photos/ui/BlurPanel.kt |
| 128 | - com/vayunmathur/photos/ui/BlurOverlay.kt |
| 129 | - com/vayunmathur/photos/ui/CurvesPanel.kt |
| 130 | - com/vayunmathur/photos/ui/HslPanel.kt |
| 131 | - com/vayunmathur/photos/ui/HealingPanel.kt |
| 132 | - com/vayunmathur/photos/ui/HealingOverlay.kt |
| 133 | - com/vayunmathur/photos/ui/LayersPanel.kt |
| 134 | - com/vayunmathur/photos/ui/LayerRows.kt |
| 135 | - com/vayunmathur/photos/ui/MaskOverlay.kt |
| 136 | - com/vayunmathur/photos/ui/SelectiveEditPanel.kt |
| 137 | - com/vayunmathur/photos/ui/DrawingSettingsPage.kt |
| 138 | ### ui/ — video editor + wallpaper + vault |
| 139 | - com/vayunmathur/photos/ui/VideoEditRoute.kt |
| 140 | - com/vayunmathur/photos/ui/VideoEditActivity.kt |
| 141 | - com/vayunmathur/photos/ui/VideoEditPage.kt |
| 142 | - com/vayunmathur/photos/ui/VideoEditPanels.kt |
| 143 | - com/vayunmathur/photos/ui/VideoEditPreview.kt |
| 144 | - com/vayunmathur/photos/ui/VideoEditCropOverlay.kt |
| 145 | - com/vayunmathur/photos/ui/VideoEditDialogs.kt |
| 146 | - com/vayunmathur/photos/ui/VideoPlayer.kt |
| 147 | - com/vayunmathur/photos/ui/WallpaperPage.kt |
| 148 | - com/vayunmathur/photos/ui/WallpaperPreview.kt |
| 149 | - com/vayunmathur/photos/ui/WallpaperControls.kt |
| 150 | - com/vayunmathur/photos/ui/SecureFolderPage.kt |
| 151 | - com/vayunmathur/photos/ui/VaultViewerPage.kt |
| 152 | - com/vayunmathur/photos/ui/VaultViewerScreen.kt |
| 153 | ### util/ — ViewModels, ML, compositing, sync (migration pending) |
| 154 | - com/vayunmathur/photos/util/GalleryViewModel.kt |
| 155 | - com/vayunmathur/photos/util/GalleryUiContract.kt |
| 156 | - com/vayunmathur/photos/util/PhotoEditViewModel.kt |
| 157 | - com/vayunmathur/photos/util/VideoEditViewModel.kt |
| 158 | - com/vayunmathur/photos/util/PhotoMapViewModel.kt |
| 159 | - com/vayunmathur/photos/util/SecureFolderViewModel.kt |
| 160 | - com/vayunmathur/photos/util/SecureFolderManager.kt |
| 161 | - com/vayunmathur/photos/util/LayerCompositor.kt |
| 162 | - com/vayunmathur/photos/util/UndoRedoManager.kt |
| 163 | - com/vayunmathur/photos/util/OverlayRendering.kt |
| 164 | - com/vayunmathur/photos/util/FaceRecognizer.kt |
| 165 | - com/vayunmathur/photos/util/FaceCropTransformation.kt |
| 166 | - com/vayunmathur/photos/util/MlSegmentation.kt |
| 167 | - com/vayunmathur/photos/util/ClipEmbedder.kt |
| 168 | - com/vayunmathur/photos/util/ClipTokenizer.kt |
| 169 | - com/vayunmathur/photos/util/ImageLoader.kt |
| 170 | - com/vayunmathur/photos/util/PanoXmpParser.kt |
| 171 | - com/vayunmathur/photos/util/PhotosNative.kt — Rust bridge |
| 172 | - com/vayunmathur/photos/util/AlbumMediaStore.kt |
| 173 | - com/vayunmathur/photos/util/SyncWorker.kt |
| 174 | - com/vayunmathur/photos/util/SyncWorkerHelper.kt |
| 175 | - com/vayunmathur/photos/util/LiveWallpaperLauncher.kt |
| 176 | - com/vayunmathur/photos/util/WallpaperHelper.kt |
| 177 | - com/vayunmathur/photos/util/AppBackupAgent.kt |
| 178 | |
| 179 | ## Verify (this module only) |
| 180 | ``` |
| 181 | ./gradlew :photos:compileDevKotlin |
| 182 | ./gradlew :photos:lint |
| 183 | ./gradlew :photos:checkMetadata |
| 184 | ``` |