Skip to content

Dead code: remove unused entries (5 commits) - #3

Open
Avithegod2010 wants to merge 5 commits into
security/audit-2026-11from
code-audit/locker
Open

Avithegod2010 wants to merge 5 commits into
security/audit-2026-11from
code-audit/locker

Conversation

@Avithegod2010

Copy link
Copy Markdown
Owner

Dead-code removal found by a per-repo audit thread (free model) and verified against this repo's own checks.

Commits:

  • 2bed9db chore(dead-code): remove unreferenced Android resources and old hero image
  • d28e170 chore(dead-code): drop unreferenced core/data helper members
  • f119823 chore(dead-code): remove orphaned duress-unlock path from SessionManager
  • 712fbfa chore(dead-code): remove orphaned inline camera path in HomeScreen
  • faed1c3 chore(dead-code): remove two unreferenced Compose helpers

Per-repo report (removed / kept-with-reason / verification):

  • removed: 27 entries, 254 lines - FloatingMenuCard and rememberHapticLongPress (ui/components/Common.kt); the orphaned inline camera path in ui/screens/home/HomeScreen.kt (launchCamera, cameraLauncher, pendingCameraFile, pendingCameraUri, plus six imports that became unused) - the Add menu navigates to Routes.CAMERA / SecureCameraScreen instead; the orphaned duress-unlock path in core/SessionManager.kt (onDuressWipe, onDecoyReady, hasDuressPassword, setDuressPassword, clearDuressPassword, performDuressUnlock) and LockerApp.hasHiddenPassword - LockerApp's coordinator now produces UnlockResult.DuressUnlocked and uses local duressConfigured/hiddenConfigured flags; unreferenced helpers BiometricKeyStore.hasKey, DisguiseManager.iconFor, SavedSearches.setPinned, TransferCodec.maxCharacters, EncryptedFileStore.cachedFileExists/cachedThumbnailPathExists, VaultRepository.findItem/allTags/setTags/setCollectionLock; Android resources @string/file_provider_authority, @color/brand_blue, @color/icon_blue; and the orphaned workflow-overview.png (its README reference was removed in 6fbd73f when locker-hero replaced it). Five commits on code-audit/locker: faed1c3, 712fbfa, f119823, d28e170, 2bed9db. 254 deletions, zero additions.
  • kept (reason): 34 - LegacyScreen plus LegacyCard/LegacyEditorDialog (reachable from LockerNavHost via Routes.LEGACY, which LockerDrawer navigates to); UnlockResult.DuressUnlocked (still produced in LockerApp:289,364 and matched in LockScreen); SessionManager.onVaultCreated (still wired at LockerApp:109); framework callbacks PageAnalyzer.analyze (CameraX ImageAnalysis.Analyzer), VaultDb.onConfigure/onUpgrade (SQLiteOpenHelper), LockerAutofillService.onFillRequest/onSaveRequest, LockerApp.onStart/onStop/onDisplayAdded/onDisplayChanged/onDisplayRemoved, ThumbnailCache.sizeOf (LruCache), AudioDetail.onIsPlayingChanged (Media3 listener); all JUnit test classes and @Test methods (runner entry points); types used only via inference (ImportedFile, TrialSample); test-only members PageQuad.longestEdge, PasswordAudit.expiredCount/expiringSoonCount; backup-format fields BackupPreview.legacyCount, BackupSummary.replaced (serialized in BackupManager); SavedSearch.pinned (read in HomeScreen:160 and CollectionsScreen:107); rememberHapticClick (many callers); importing in HomeScreen (still read by the progress indicator, so not zero-reference); proguard-rules.pro (named in build.gradle.kts while R8 is off); scripts/build-tests.ps1 E: fallback (runtime filesystem check, not a constant dead branch); DEV_BUILD build-variant branches; all Android manifest components (system entry points) and all other resources (R.type.name / @type/name references verified); no commented-out block over ~10 lines and no constant-guarded dead branch found.
  • verified with: case-sensitive git grep -F/git grep -w over

FloatingMenuCard and rememberHapticLongPress in ui/components/Common.kt had
exactly one case-sensitive hit across all tracked files - their own declaration.
rememberHapticClick (the live sibling) and LockerCard cover both use cases.
No import became orphaned; all imports remain used by other declarations in the file.
launchCamera, cameraLauncher (TakePicture), and the pendingCameraFile/pendingCameraUri
state had zero callers: the Add menu navigates to Routes.CAMERA, which opens
SecureCameraScreen instead. Removed the now-unused Uri, FileProvider, File,
Formatting, rememberLauncherForActivityResult and ActivityResultContracts imports.
Proven by case-sensitive git grep across all tracked files (one hit at each definition).
LockerApp now handles duress by switching to the decoy space (producing
UnlockResult.DuressUnlocked itself), so SessionManager's onDuressWipe,
onDecoyReady, hasDuressPassword, setDuressPassword, clearDuressPassword and
performDuressUnlock are never assigned/called; LockerApp.hasHiddenPassword is
likewise replaced by the local hiddenConfigured flag. Callbacks onVaultCreated
and UnlockResult.DuressUnlocked stay - both still have live producers/consumers.
Proven with case-sensitive git grep over all tracked files and source review.
BiometricKeyStore.hasKey, DisguiseManager.iconFor, SavedSearches.setPinned,
TransferCodec.maxCharacters, EncryptedFileStore.cachedFileExists/
cachedThumbnailPathExists and VaultRepository.findItem/allTags/setTags/
setCollectionLock each had a single case-sensitive hit repo-wide - the
declaration itself. Collection locks are written via addCollection/updateCollection
(EditorShared) and tags via updateItem/renameTag; ImportedFile, TrialSample,
SavedSearch.pinned and the test-only audit helpers remain (they are read/used).
Proof: git grep -F over every tracked file, plus a whole-repo declaration scan.
…image

@string/file_provider_authority, @color/brand_blue, @color/icon_blue and the
root workflow-overview.png had zero references. Callers hardcode the FileProvider
authority and the icon colors as literals; git history (2089fbb added the image,
6fbd73f removed its README reference) shows it was superseded by locker-hero.
Verified with case-sensitive git grep across Kotlin/XML/manifest/gradle/docs and
an R.type.name / @type/name reference scan for every remaining resource.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant