Compare commits

...

16 Commits

Author SHA1 Message Date
SoftwareApp 64431d5757 docs: answer the Advertising ID declaration from the dependency graph, not from the source
Play asks whether the app uses advertising ID "including any SDKs that your app imports that use
advertising ID", and that clause is the whole difficulty: the ID comes from
play-services-ads-identifier, which merges AD_ID into the manifest by itself - so one unrelated
dependency could turn this answer into a false statement without a line of app code changing. The
answer is No, and the checklist now records how that was established on 2026-10-14 against the
artefacts rather than against intentions:

- the release runtime classpath contains no gms/firebase/ads/billing/play-services entry at all, so
  there is no direct *or transitive* SDK that would ask for the ID
- aapt2 dump badging on the release APK lists the seven permissions the audit table already
  documents plus the framework's DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION - no AD_ID, and no
  Privacy Sandbox permission either
- the same check on base/manifest/AndroidManifest.xml inside the .aab finds nothing, which matters
  because the bundle is the artefact Play's own scanner reads
- the shipped classes.dex contains no com.google.android.gms classes, and the app has no INTERNET
  permission, so an ID could not be transmitted even if one were read

The last two rows are the ones to re-run after any dependency change: they are cheap, and this is
the declaration a stray library answers wrongly on the app's behalf. The same reasoning answers Data
safety's device-identifiers question, which the item now says out loud.

ROADMAP: the remaining-paperwork row names the advertising ID question rather than leaving it
implied by "ads".
2026-10-14 13:48:04 +02:00
SoftwareApp 6315af1f92 docs: cut the Photo and video permissions answer to the Console's 250-character box
The field takes 250 characters, not the 1 689 the draft assumed, so the answer is now 243
characters - measured, not estimated, and deliberately pure ASCII, because one curly quote or dash
pasted from a doc would silently shift the count:

  The app needs READ_MEDIA_IMAGES to read every photo, because duplicate detection compares each
  photo with every other. A picker exposes only selected files, and a photo's duplicates are
  exactly the files it withholds. All hashing is on-device.

What survived the cut is the sentence that carries the argument: the reason the permission is
needed is the same reason the picker cannot work - duplicates are, by definition, the files nobody
selected. What went is the statistical-fit paragraph and the delete path, neither of which a
reviewer needs in order to judge *this* question, and both of which are still in the longer drafts.

Also here: a 228-character alternate that opens with the comparison rather than the permission, and
the two long versions re-labelled as fallbacks for anywhere not capped at 250 (Play sometimes
follows up by email). The evidence table stays unchanged - it is the defence if the answer is
questioned, not part of what gets pasted.
2026-10-14 13:43:13 +02:00
SoftwareApp fe28373433 docs: correct the Balanced/Aggressive pHash ceilings in the README table
The table said 12 and 18 bits; DuplicatePolicy says 15 and 22, and the device agrees: with a
22-photo library the fit has too little data and falls back to the ceiling, and the results screen
prints "similarity cut: pHash <= 15 bits (default)" - 15, not 12.

The RGB column of the same table already matched the enum (60 and 84), which is what a pHash-only
edit looks like: the ceilings were evidently retuned and this one column was not carried along.

The old 18 was not invented - it is the measured F1 optimum that AGGRESSIVE's doc comment calls out
("set above the measured F1 optimum (~18 on real photographs)"), i.e. the value the ceiling is
deliberately placed above rather than the ceiling itself. Saying so here keeps the corrected row
from reading as though a measured optimum had been changed.
2026-10-14 13:38:33 +02:00
SoftwareApp 23bbc4104b docs: draft the Photo and video permissions declaration answer
The Console flags READ_MEDIA_IMAGES as undeclared and asks a specific question per permission - why
the Android photo picker does not fully support the app, and why the permission is needed. The old
draft here answered only the second half, in general terms, so it is replaced with an answer in the
order the form asks, at two lengths (1 689 chars, and 682 for a small box).

The picker half is what a reviewer actually weighs, and the code makes it concrete instead of
rhetorical: a picker hands over the items the user selects, while the duplicates of a picked photo
are precisely the files it never hands over - and the app's similarity threshold is fitted per scan
from the library's own pairwise hash-distance histogram (AdaptiveThreshold will not fit at all below
200 pairs), which no hand-picked subset can supply. The selection is not a sample of the library,
it is the part the duplicates are not in.

Both claims sit in a table next to their source in the code, together with the other things the
answer asserts - no INTERNET, deletion only through createDeleteRequest/createTrashRequest, and
partial access implemented rather than merely declared - so the text can be defended if Play asks.

Also written down: the form asks about READ_MEDIA_IMAGES only, since
READ_MEDIA_VISUAL_USER_SELECTED is the narrow half of the pair and needs no justification; if a
video is asked for as well, the foreground-service demo is a fallback but was filmed for a different
question; and a refusal would not require code changes, because the partial mode already runs - what
would be lost is the promise.
2026-10-14 13:38:33 +02:00
SoftwareApp 68dcbc5db6 docs: the video's link is its Gitea page, not the raw URL, which its own CSP blocks
Checked the way a browser does it rather than the way curl does, and curl had given a false green:
Gitea sends `Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; sandbox` with
every /raw/ response. That is deliberate - it is what makes serving raw HTML and SVG safe - but it
also blocks the media load when a browser navigates straight to a video, so the tab stays blank with
no error. The same URL plays fine as a subresource, which is exactly why the file's page in Gitea
shows a player: that page embeds <video controls src=".../raw/branch/main/...mp4">.

So the declaration's link is the /src/ page URL, and /raw/ is documented as the curl-and-download
URL instead. Everything verified about both URLs is written down in step 5 - including the two ways
to get a player with no Gitea chrome around it, if that is ever wanted: an unlisted YouTube upload,
or dropping the header for this one path on the Gitea host's Caddy proxy, which must stay scoped to
store-assets/ precisely because that header is what protects raw HTML and SVG.

The file itself was never the problem: 200, video/mp4, Content-Disposition: inline, bytes
sha256-identical to the recording, and Range: bytes=0-99 -> 206 with the matching Content-Range.
2026-10-14 13:28:49 +02:00
SoftwareApp 31a0edbe61 docs: record that the Gitea link answers range requests, so the video seeks 2026-10-14 13:23:13 +02:00
SoftwareApp 1cb188a56b docs: follow the asset publication through the documents that described it
Committing the store assets changed a rule that four files stated, so they now state the new one
instead of contradicting the tree:

- STORE_LISTING: "screenshots are not committed" becomes what is committed, why it is safe (every
  published frame is generated demo content), and what is still deliberately out of git (raw
  captures, demo photos, the video's milestone PNGs). It also spells out the public URL pattern,
  because that is now the deployment step rather than a footnote.
- PLAY_RELEASE_CHECKLIST: the two "(git-ignored)" annotations on the screenshot directories become
  "(committed)", and step 5's video item carries the exact link to paste plus what was verified
  about it (200, video/mp4, Content-Disposition: inline, sha256 match) and the two traps in using
  it (pinned to main, so a re-shoot overwrites in place; and replacing it at all means resubmitting
  the declaration).
- ROADMAP: M10 no longer claims the screenshots are left uncommitted, and the declaration's blocker
  row loses its "hosting remains" clause - the file is published, so only pasting is left.
- README: says where the link comes from, so the next reader does not go looking for a host.
2026-10-14 13:22:38 +02:00
SoftwareApp 9fb5e7de3d feat: publish the store assets, so Play's declaration has a video link
Play's foreground-service declaration asks for a *link* to the demonstration video, which means
something has to be reachable without a login. The simplest answer is to stop ignoring the assets
and let Gitea serve them, so the video, the twelve normalised screenshots and the
already-committed icon and feature graphic all live in the repository now and are downloadable at

  https://gitea.softwareapp-hb.de/fishfacegit/foto-duplicate-finder/raw/branch/main/<path>

That reverses the old "screenshots are never committed" rule, and the reason it is safe to reverse
is worth stating plainly: the library in every published frame is the *generated* one
(tools/make-demo-photos.py), never a real one. The phone set was re-checked frame by frame before
publishing - every thumbnail in it is a demo image and the only trace of the device's own
5,385-photo library is a count in the summary card. .gitignore and docs/STORE_LISTING.md say so
where the rule used to be, so the next person does not have to reconstruct why.

Still ignored, deliberately: the raw adb captures, the demo photos themselves, and the recording
script's milestone PNGs (store-assets/fgs-demo/checkpoint-*.png) - debugging aids, not assets.
2026-10-14 13:21:07 +02:00
SoftwareApp 52cf2fc85a feat: record the FGS video on the real device, and fix what the take exposed
The declaration's video exists now: store-assets/fgs-demo/foreground-service-demo.mp4, recorded on
the test device (Android 12 / MIUI, 2a2ae895) with INSTALL=0 WARMUP=0, and then checked frame by
frame rather than assumed - the intro at 0 s, the scan starting ("Comparing file signatures...
91/102", 8 s), the shade held open for ~6 s with the live notification ("Finding duplicate photos
/ Looking for visually similar photos... / CANCEL", 13-18 s) while the scan kept running behind
it, and the finished results at the end. Hosting it and pasting the link into the declaration is
what remains.

The script grew two flags, both because an earlier attempt got it wrong:

- WARMUP=0 skips the warm-up and keeps the *cold* scan on camera. A warm scan of this library
  takes 5.4 s - less than the notification shade takes to open - so the first phone take filmed an
  empty shade, convincingly. The warm-up only ever existed for the emulator's FGS deadline
  problem, which a real device does not have.
- INSTALL=0 records with the build already on the device, because MIUI does not allow adb
  installs: the command hangs on two on-device prompts (Google Play Protect, then MIUI's own
  Installieren) and auto-cancels as INSTALL_FAILED_USER_RESTRICTED if they go unanswered.

Also found by running this against a phone instead of an AVD:

- the trigger is chosen by mode - the intro's "Start scan" when the warm-up is skipped, the
  results screen's top-bar "Scan" when it is not - and the lookup result is checked rather than
  assumed,
- pacing is a variable now, tightened in the WARMUP=0 path, because the phone's cold scan is only
  ~20 s and the shade has to be open while it runs,
- the library check counts the demo folder rather than the whole device library: on a phone the
  rest of the library is the owner's own photos and is supposed to be there,
- the warm-up became a function and does not run at all under WARMUP=0, and a stray reference to
  its `attempt` variable (fatal under `set -u`) is gone.

Step 5 of the checklist now carries the recorded recipe, both flags with the reasons, and two
device facts that were invisible until a phone was attached: MIUI fails every synthetic tap with
INJECT_EVENTS until USB debugging is enabled, and toggling that resets the USB connection onto a
new /dev/bus/usb node. The emulator verdict is compressed to what it is - the platform kills the
app on every scan start there (am_crash ForegroundServiceDidNotStartInTimeException, no am_kill),
with QEMU's -icount clock dilation noted as the one thing that ever worked, and only once.
2026-10-14 13:16:24 +02:00
SoftwareApp ddc7fb44b0 docs: record the QEMU clock-dilation lead for the FGS video
Chasing the video on the emulator found one lever that actually attacks the failure, and it is
worth writing down even though it did not hold:

  emulator -avd phone ... -qemu -icount shift=1,sleep=off

Without -icount the guest clock is tied to the host's wall clock, so Android's five-second
startForegroundService() deadline means five real seconds however slowly TCG executes - which is
what kills the app here every time. With -icount the guest clock advances per executed
instruction, and it measured 2.30x slow (30.9 s host to 13.4 s guest uptime). On that boot a scan
start succeeded: the app's notification appeared five seconds after the tap and there was no
am_crash, the only success recorded on this machine.

It then stopped reproducing - later attempts produced neither a notification nor a crash. Two
possibilities, and the second is an app-side diagnosability gap: either the tap never reached the
app, or ScanService.start() swallowed a ForegroundServiceStartNotAllowedException, which it does
silently (it catches IllegalStateException and does nothing with it, so logcat shows nothing at
all). Notes say so, and point at SETTLE_SECONDS / WARM_SECONDS for scaling the waits, because a
dilated guest is slower at everything - uiautomator dumps included.

The script also retries a tap (up to three times, re-reading the coordinates) before falling back
to a cold restart, since on a slow emulator the window can still be settling while the
accessibility tree already lists the button - and a restart costs another cold start. The
recommendation stands: record the take on the phone.
2026-10-14 12:25:02 +02:00
SoftwareApp 179bc2cc33 fix: prove the FGS video's scan start by notification, not by the service record
The script could report "scan started" on runs where the app was being killed, which sent me
chasing a "mid-scan death" that never happened. The mistake was the signal: dumpsys activity
services lists a service *record* from the moment startForegroundService() is called, so it says
nothing about whether startForeground() was reached - and that gap is exactly what the platform's
deadline measures. logcat's events buffer shows what really happened on every attempt:

  am_crash: [..., android.app.ForegroundServiceDidNotStartInTimeException,
             Context.startForegroundService() did not then call
             Service.startForeground(): .../ScanService]
  am_proc_died: [...]

No am_kill, no low-memory record: not memory pressure, and not a crash in the app's own code. The
script now waits for the app's notification, which only exists once startForeground() has been
called, and prints that am_crash line when the service never starts, so a failure is never
mistaken for a success again.

Also in the script:

- let the emulator settle before the run (first-boot work competes for the same CPU) and give the
  process time to load its classes before asking it to start a service inside the budget, both
  overridable as SETTLE_SECONDS and WARM_SECONDS,
- give up with a non-zero exit and an explicit "record this on a real device" message rather than
  carrying on to record a video whose scan never started,
- read the events buffer rather than the main one when reporting the reason.

Verdict for the docs, corrected: this capture cannot be done on a KVM-less emulator, and the
previous "second failure mode" was this one misread. The last crash landed on a process that had
been alive and idle for over a minute, so no amount of warming fixes it - while on the phone the
same build scans 5,363 photos in 20 s with the notification up the whole time. The take belongs on
the phone; the script is the checklist for what it has to show.
2026-10-14 11:39:49 +02:00
SoftwareApp ae05a0dad4 docs: add a hand-recording shot list for the FGS video
The script is a convenience, not a requirement: any Android 11+ phone can record the same
journey from the quick settings, with no adb and no tooling. Spell out the six steps so the
take can be done by hand if that is easier, with the two things a reviewer needs to be able to
follow - the trigger, and the service still working after the app leaves the screen.
2026-10-14 11:22:35 +02:00
SoftwareApp ea894841a2 docs: pin the FGS use case to Local processing > Other
The Console's Local processing options are Media transcoding, Importing/exporting and Other,
not the two-entry list the help page implies, so record which one this app takes and why the
other two are misdeclarations rather than near-misses:

- Media transcoding is converting media into a different format; the scan writes no media file
  at all, it only reads photos to hash and compare them.
- Importing/exporting is moving files in or out of the app; the app's only write is its own
  private hash index, which no other app ever sees - that is also what keeps "nothing leaves
  the device" true.
- Other is described by Play as "specifically user-initiated work and not for regular system or
  server-initiated tasks", which is exactly a scan the user taps Start scan for.

Worth spelling out because a use case that does not match the app is a misdeclaration, and the
description and the accompanying video have to support whichever option is chosen: "reads the
photo library and writes a small local index of file hashes" only fits Other.
2026-10-14 11:14:07 +02:00
SoftwareApp 1ce2f2e1f4 feat: record the foreground-service video Play's declaration asks for
The App content > Foreground service permissions form does not just want the justification that
was already written down. Per declared type it asks for four things, one of which is "a link to
a video demonstrating each foreground service feature. The video should demonstrate the steps
the user needs to take in your app in order to trigger the feature."

tools/record-fgs-demo.sh records exactly that journey on a device or emulator: the app on its
intro, the user tapping Start scan, Home, the ongoing notification visible in the shade while
the scan keeps running, and back into the app for the results. It loads the generated demo
library first so no real photo is in frame, writes a checkpoint PNG at each milestone so the
recording can be checked without decoding it, and takes the library off the device afterwards.
The output is git-ignored, like the screenshots.

Four things the script has to get right, each learned by getting it wrong first:

- bounds="[x1,y1][x2,y2]" cannot be parsed by stripping everything but digits: the "][ "
  between the corners goes too, which glued y1 to x2 and produced coordinates like
  "976 723061" - a tap that lands nowhere and reports no error at all.
- No single text matcher works: an exact match never finds the results card ("2 duplicate
  groups"), while a substring match lets "Scan" match both "Start scan" and "Scanned in
  39.7 s". Both matchers exist and each call site uses the right one.
- A finished scan leaves the app on its results screen, where the intro's button no longer
  exists - tapping those stale coordinates silently does nothing.
- `set -e` plus start="$(failing command)" aborts a run with no message whatsoever, which
  cost a whole debugging cycle.

Checklist step 5 now carries all four fields with paste-ready text: the description, the user
impact if the scan is deferred or interrupted (a scan is not deferrable work - the user is
waiting for a result, so there is no WorkManager/JobScheduler fallback), the use case
(Local processing: Other, the only dataSync option that describes a local, user-initiated
scan), and the video link.

Recording the take on this machine is not reliable, and the docs say so rather than pretending
otherwise, because both failures are platform-level rather than app-level:

- a cold app can miss Android's 5-second startForeground deadline and be killed, giving
  ForegroundServiceDidNotStartInTimeException -> Force finishing activity, i.e. the launcher
  where the scan should have started. The warm-up phase fixes it (a process that has started
  the service once never misses), but the fallback path of restarting the app gives the warmth
  back again, which is why the recorded scan is now triggered from the results screen's top-bar
  "Scan" instead of the intro's button.
- the app also died mid-scan on the emulator, with the launcher on screen afterwards and no
  exception of its own anywhere in logcat. No amount of warming fixes that one.

Neither reproduces on the real test device, where the same 22-photo library scans without
incident, so the take belongs on the phone. The script is the checklist for what it must show.
2026-10-14 11:13:21 +02:00
SoftwareApp f45e3b79ab docs: cover the tablet screenshot slots and settle app pricing
Two Console-facing subjects, both decided here instead of in the Console.

Tablet screenshots (7-inch and 10-inch)
--------------------------------------
Play keeps a separate screenshot slot per form factor and asks for at least four
screenshots on tablets, so the four phone captures did not cover them. Both sets are now
captured on AOSP Android 12 AVDs, over the same generated 22-photo demo library, and
normalised with FORM_FACTOR=tablet-7in|tablet-10in:

- 7-inch - Nexus 7 2013: 1200x1920 portrait, sw600dp, 320 dpi, four files
- 10-inch - Medium Tablet: 1600x2560 portrait, sw800dp, 320 dpi, four files

This machine has no /dev/kvm - the node cannot even be created, because mknod is refused
for the container as root - so the emulator ran in pure software emulation (-accel off
-no-window -gpu swiftshader_indirect): about 3 minutes to boot, 1-12 s per screenshot.
hide_error_dialogs was switched on and the animation scales off, because under TCG
SystemUI raises an ANR dialog that would otherwise sit in the frame; the 10-inch profile
boots landscape and its portrait rotation is 3, not 0. The scanning frame comes from a
screencap burst started before the tap, since 22 photos scan in seconds, and the tap
coordinates come from uiautomator dumps rather than guesswork.

The results screens are not staged: a finished scan auto-selects all but best, so "14
selected, 43.7 MB" is the default state. 2 duplicate groups, 16 of 22 photos, 43.7 MB
reclaimable, scanned in 39.7 s (7-inch) and 53.1 s (10-inch). Nothing except the demo
library was ever pushed to either AVD and it is deleted again afterwards, so no real
photo can appear in the tablet sets. Screenshots stay out of git, as before.

App pricing: a one-time paid app
--------------------------------
The one irreversible decision in this release. Play's rule: an app can go paid -> free,
but "once your app has been offered for free, the app can't be changed to paid" - a new
package name would be needed - so this had to be settled before the first upload, which
has not happened yet (versionCode 2).

Chosen over free with a Pro unlock because it is the only model that costs the app
nothing: no Billing dependency, no com.android.vending.BILLING permission, no Data
Safety answers, and the "no internet permission at all" claim survives untouched.
Checked rather than assumed: unpacking com.android.billingclient:billing:9.1.0 shows its
manifest declares only com.android.vending.BILLING and the billing service queries, so
in-app purchase would not have added INTERNET either. Billing 8+ is the current
requirement (latest 9.1.0) if that is ever revisited.

Price: base EUR 2.99 with a 14-day 50% launch sale at EUR 1.49. A EUR 1 base price was
considered and rejected: a sale can always be added, but a low anchor cannot be undone,
and a paid app's first transaction is its only transaction. Play's fee for a paid app's
initial purchase is 10% + 5% billing fee (~15%) for the first $1M/year of new-install
transactions in the EEA, so EUR 2.99 nets ~EUR 2.54 against ~EUR 0.85 at EUR 1. The sale
rules shape the launch: 1-14 days live, 30 days between one sale ending and the next
starting, and the app must be published before a sale can be created. The strikethrough
does appear in Germany, which is not one of the 12 EU states and the UK that hide it.

The listing copy had to stop saying "free": the short description is now "Find and remove
duplicate photos. Ad-free, works offline, no uploads." (69/80 chars) and the full
description gains one factual pay-once line plus a "sold through Google Play as a
one-time purchase" bullet (2,426/4,000). The price stays out of the title, icon and
developer name, because Play's metadata policy forbids price and promotional wording
there. PRIVACY.md gains a Purchases section - Google Play processes the payment, the app
has no payment code and no network access at all - and its date moves to 2026-10-14, so
the published copy needs re-pushing to Gitea.

No code changed, so the signed 1.0.1 .aab is untouched (sha256 f8e6a29a...). What is
left is Console work: a payments profile, the price and the launch sale on Products >
App pricing, and a promo-code copy to test the paid listing end to end.
2026-10-14 09:48:57 +02:00
SoftwareApp 5cb7ad66a8 feat: make the store-screenshot normaliser form-factor aware
Play gives phones and each tablet size a screenshot slot of their own (Phone, 7-inch
tablet, 10-inch tablet) and asks for at least four screenshots per large-screen form
factor, so the normaliser takes FORM_FACTOR=phone|tablet-7in|tablet-10in and keeps one
raw and one output directory per factor:

  store-assets/raw-screenshots/<form-factor>/   adb captures (git-ignored)
  store-assets/screenshots/<form-factor>/       what gets uploaded

The tablet form factors crop 0 px of system chrome on purpose, and that is checked
rather than guessed: every tablet profile in the SDK's own device definitions is already
inside Play's 2:1 cap (7in WSVGA 1024x600, 10.1in WXGA 1280x800, Nexus 7 2013
1200x1920, and Nexus 10 / Medium Tablet / Pixel Tablet at 2560x1600), so the 93/130 px
phone crop exists only because a 1080x2400 phone frame is 2.22:1. Cropping a tablet is
therefore cosmetic, and is now opt-in through STATUS_BAR_PX / NAV_BAR_PX.

The 2:1 clamp still runs for every form factor, and each file is now checked against
Play's limits as it is written (shorter side >= 320 px, longer side <= 3840 px) - the
phone captures only ever got that check by hand. A missing input directory or an unknown
form factor now fails with an actionable message instead of a bash error.

The four existing phone captures move to raw-screenshots/phone/ and normalise to the
same 1080x2160 RGB files as before, byte for byte. The 7-inch and 10-inch captures were
taken with this script on AOSP AVDs; how, and the numbers they show, are recorded in
docs/STORE_LISTING.md.

tools/make-store-assets.sh now prints the two tablet invocations as well, so the obvious
next step after generating the icon and feature graphic is not the phone-only one.
2026-10-14 09:48:49 +02:00
22 changed files with 1070 additions and 85 deletions
+9 -1
View File
@@ -26,4 +26,12 @@ keystore.properties
fixtures/ fixtures/
store-assets/raw-screenshots/ store-assets/raw-screenshots/
demo-photos/ demo-photos/
store-assets/screenshots/
# Note that the *finished* store assets are not ignored: Play wants public links for some of them
# (the foreground-service demonstration video), and the files a listing is made of belong beside
# the code that produces them. So the icon, the feature graphic, `store-assets/screenshots/` and
# `store-assets/fgs-demo/` are committed — everything visible in them comes from the generated
# demo library (tools/make-demo-photos.py), so publishing them exposes nobody's photos. The
# exception is the milestones the recording script saves along the way, which are debugging aids
# rather than assets:
store-assets/fgs-demo/checkpoint-*.png
+13 -2
View File
@@ -1,12 +1,13 @@
# Privacy Policy — Foto Dup Finder # Privacy Policy — Foto Dup Finder
_Last updated: 2026-10-13_ _Last updated: 2026-10-14_
## Summary ## Summary
Foto Dup Finder finds and removes duplicate photos **entirely on your device**. Foto Dup Finder finds and removes duplicate photos **entirely on your device**.
The app does **not** collect, transmit, sell or share any of your data. It has no The app does **not** collect, transmit, sell or share any of your data. It has no
network access at all. network access at all. It is sold once through Google Play; the purchase is handled
entirely by Google Play, never by the app (see [Purchases](#purchases)).
## What the app accesses ## What the app accesses
@@ -51,6 +52,16 @@ that repeat scans are fast. This database contains no image content and never le
your device. Uninstalling the app, or clearing its storage in Android Settings, your device. Uninstalling the app, or clearing its storage in Android Settings,
removes it completely. removes it completely.
## Purchases
The app is **sold once through Google Play**. There is no subscription and there is nothing to buy
inside the app.
Google Play processes the payment and holds the payment details. The app contains no payment code
and never receives them, because it has no network access of any kind (see above). Refunds, order
problems and any question about a charge are handled by Google Play, and the developer can be
reached at the address below.
## Children ## Children
The app is a general-purpose utility and is not directed at children. It collects no The app is a general-purpose utility and is not directed at children. It collects no
+22 -5
View File
@@ -121,8 +121,8 @@ Sensitivity presets (both values are ceilings; the pHash one is adapted per scan
| Policy | pHash ceiling | RGB ceiling | Notes | | Policy | pHash ceiling | RGB ceiling | Notes |
|---|---|---|---| |---|---|---|---|
| Exact copies only | – | – | byte-identical files, no decoding at all | | Exact copies only | – | – | byte-identical files, no decoding at all |
| Balanced (default) | 12 bits | 60 / 192 | the recommended setting | | Balanced (default) | 15 bits | 60 / 192 | the recommended setting |
| Aggressive | 18 bits | 84 / 192 | catches heavier re-edits | | Aggressive | 22 bits | 84 / 192 | catches heavier re-edits |
Banding gives *exact* candidate recall for pHash distances up to 7 (see the comment in Banding gives *exact* candidate recall for pHash distances up to 7 (see the comment in
`DuplicateGrouper`). `DuplicateGrouper`).
@@ -164,8 +164,11 @@ the reclaimable-bytes maths.
./gradlew :app:testDebugUnitTest ./gradlew :app:testDebugUnitTest
``` ```
There is no instrumentation test and no emulator in this environment, so UI There is no instrumentation test, so UI behaviour is verified by installing the debug build on a
behaviour is verified on a real device via `adb install` or Play internal testing. device or an emulator (`adb install -r app/build/outputs/apk/debug/app-debug.apk`) and driving it by
hand or with `adb shell input tap`. That is how the store screenshots are taken; the tablet sets were
shot on AOSP AVDs running in **software emulation**, because this machine exposes no `/dev/kvm`
(see [docs/STORE_LISTING.md](docs/STORE_LISTING.md)).
## Releasing to Google Play ## Releasing to Google Play
@@ -174,11 +177,25 @@ listing, Data Safety, release notes, rollout), [docs/STORE_LISTING.md](docs/STOR
(ready-to-paste listing copy plus the icon / feature graphic generators) and (ready-to-paste listing copy plus the icon / feature graphic generators) and
[PRIVACY.md](PRIVACY.md). [PRIVACY.md](PRIVACY.md).
The app is published as a **one-time paid app** — no ads, no subscription, no in-app purchases, and
therefore no Billing code or `com.android.vending.BILLING` permission in the APK: the price lives on
the listing, not in the build ([why](docs/STORE_LISTING.md#app-pricing)).
The upload-ready graphics and screenshots live in [`store-assets/`](store-assets/). The upload-ready graphics and screenshots live in [`store-assets/`](store-assets/).
`tools/make-store-assets.sh` and `tools/make-store-screenshots.sh` regenerate them from the `tools/make-store-assets.sh` and `tools/make-store-screenshots.sh` regenerate them from the
app's own icon vectors and from `adb` captures — always inside the repo, never in `$HOME`. app's own icon vectors and from `adb` captures — always inside the repo, never in `$HOME`.
Screenshots are kept per form factor (`store-assets/{raw-,}screenshots/{phone,tablet-7in,tablet-10in}/`)
because Play gives phones and each tablet size a slot of their own: `FORM_FACTOR=tablet-7in`
selects the 7-inch pipeline, and the tablet runs deliberately crop no system chrome because a
tablet frame is already inside Play's 2:1 cap. All three sets are captured — the phone set on a real
device, the tablet sets on AOSP AVDs; see [docs/STORE_LISTING.md](docs/STORE_LISTING.md).
`python3 tools/make-demo-photos.py` draws the synthetic photo library the results screenshot is `python3 tools/make-demo-photos.py` draws the synthetic photo library the results screenshot is
captured over, so the listing never shows a real one. captured over, so the listing never shows a real one. The finished assets are **committed** —
including the foreground-service demonstration video that [the declaration](docs/PLAY_RELEASE_CHECKLIST.md)
links to — and Gitea serves them without a login, so pushing is the deployment step:
`…/src/branch/main/store-assets/…` is the page a browser opens (and the shape Play's video link
takes, because a `/raw/` URL carries a `default-src 'none'` CSP that stops a video playing inline),
`…/raw/branch/main/…` is the bytes.
User-visible changes are tracked in [CHANGELOG.md](CHANGELOG.md); the Play "What's new" User-visible changes are tracked in [CHANGELOG.md](CHANGELOG.md); the Play "What's new"
text you type per release is separate and lives only in the Play Console. text you type per release is separate and lives only in the Play Console.
+302 -25
View File
@@ -75,15 +75,43 @@ Ready-to-paste copy and the generated graphics live in
[docs/STORE_LISTING.md](STORE_LISTING.md) (milestone M10). Everything below is a Console [docs/STORE_LISTING.md](STORE_LISTING.md) (milestone M10). Everything below is a Console
action except the items marked **[code]**. action except the items marked **[code]**.
- [ ] App name (≤ 30 chars): "Foto Dup Finder". - [ ] ⚠️ **App pricing — do this before the first upload; it is the one irreversible decision.**
Play, *Set up your app's prices*: *"You can change your app from paid to free. Once your app has
been offered for free, the app can't be changed to paid. If you want to charge for the app, you
need to create a new app with a new package name and set a price."* This release has not been
uploaded yet (`versionCode` 2 is the first), so a paid app is still possible; after the first
upload to any track it is not. In the Console:
1. **Set up a payments profile** with your tax rates (Play asks the first time you set a price).
2. **Products > App pricing** → *"Your app is"* → **Make your app paid**, and enter the base price
**€2.99** (one-time). Leave *"Default price includes tax"* off unless €2.99 is meant to be the
final gross price in the EU — off, a German buyer pays €3.56.
3. Check the **local prices** Play derives for each country — a country with no price is a
country where the app is unavailable.
4. [ ] **Launch sale: 50% off (€1.49) for 14 days.** A sale can only be created *after* the app is
published (*App pricing > Sales > Create sale*), it can be **live for 1–14 days at most**, and
**30 days must pass between one sale ending and the next starting** — so this is a single
deadline-driven window, not a permanently lower launch price. Percentage discounts must be
between 10% and 100%. The original price is struck through everywhere except in 12 EU member
states and the UK (Germany does show it).
5. [ ] **Test the paid listing end to end**: install your own copy through a **promo code**
rather than a real purchase. A giveaway code is the only trial mechanism a paid app has, and
it doubles as the check that a buyer really does receive a working app.
**[code]** nothing to build: no Billing dependency, no `com.android.vending.BILLING` in the
merged manifest. Rationale, the fee arithmetic and the sale rules:
[STORE_LISTING](STORE_LISTING.md) › App pricing.
- [ ] App name (≤ 30 chars): "Foto Dup Finder" (15 chars).
- [ ] Short description (≤ 80 chars) — two options are drafted and length-checked in - [ ] Short description (≤ 80 chars) — two options are drafted and length-checked in
STORE_LISTING.md. STORE_LISTING.md (69 and 65 chars). **Neither says "free"**: the app is paid, so the claim would
- [ ] Full description (≤ 4000 chars) — drafted and length-checked in STORE_LISTING.md. be false, and Play's metadata policy keeps price and promotional wording out of the title,
icon and developer name.
- [ ] Full description (≤ 4000 chars) — drafted and length-checked in STORE_LISTING.md (2 426 chars,
so there is room to grow). The one price line ("Pay once, then own it…") sits in the body for
the same policy reason.
- [x] **App icon** 512×512 PNG **[code]** — `tools/make-store-assets.sh` renders it from the - [x] **App icon** 512×512 PNG **[code]** — `tools/make-store-assets.sh` renders it from the
same vectors as the adaptive icon in `res/drawable/ic_launcher_*`. same vectors as the adaptive icon in `res/drawable/ic_launcher_*`.
- [x] **Feature graphic** 1024×500 PNG **[code]** — same script. - [x] **Feature graphic** 1024×500 PNG **[code]** — same script.
- [x] **Screenshots** (at least 2, up to 8) **[code]** — four are captured and normalised to - [x] **Phone screenshots** (at least 2, up to 8) **[code]** — four are captured and normalised to
1080×2160 in `store-assets/screenshots/` (git-ignored): empty state, scanning 1080×2160 in `store-assets/screenshots/phone/` (committed): empty state, scanning
(`5353 / 5385`), results (**17 duplicate groups, 54 of 5385 photos, 83.5 MB reclaimable**) (`5353 / 5385`), results (**17 duplicate groups, 54 of 5385 photos, 83.5 MB reclaimable**)
and the Options menu. They were shot after a real permission grant and over the generated and the Options menu. They were shot after a real permission grant and over the generated
demo library (`tools/make-demo-photos.py`), so neither the "Photo access needed" banner nor demo library (`tools/make-demo-photos.py`), so neither the "Photo access needed" banner nor
@@ -94,6 +122,24 @@ action except the items marked **[code]**.
⚠️ Play rejects a screenshot whose longer side is more than 2× its shorter side, so a ⚠️ Play rejects a screenshot whose longer side is more than 2× its shorter side, so a
1080×2400 phone capture has to be cropped to 1080×2160; 1080×2400 phone capture has to be cropped to 1080×2160;
`tools/make-store-screenshots.sh` does exactly that (status and navigation bars only). `tools/make-store-screenshots.sh` does exactly that (status and navigation bars only).
- [x] **7-inch tablet screenshots** **[code]** — captured on a `Nexus 7 2013` AOSP Android 12 AVD
(1200×1920 portrait, `sw600dp`) and normalised to `store-assets/screenshots/tablet-7in/`
(committed) with `FORM_FACTOR=tablet-7in ./tools/make-store-screenshots.sh`: the same four
screens as the phone set, over the same generated demo library — empty state, scanning
(*“Looking for visually similar photos…”* 20 / 22), results (**2 duplicate groups, 16 of 22
photos, 43.7 MB reclaimable**, scanned in 39.7 s) and the Options menu (✓ on *Balanced*).
Play asks for **at least 4 screenshots** on tablets, so four is the floor, not the target.
📋 A tablet frame is already inside Play's 2:1 cap, so this form factor deliberately crops
**0 px** of system chrome; the tablet captures are the raw screencaps, flattened to 24-bit.
- [x] **10-inch tablet screenshots** **[code]** — same run on a `medium_tablet` AOSP Android 12 AVD
(1600×2560 portrait, `sw800dp`), normalised into `store-assets/screenshots/tablet-10in/` with
`FORM_FACTOR=tablet-10in`: scanning at 20 / 22 and the same **2 groups · 16 of 22 photos ·
43.7 MB reclaimable** results screen, scanned in 53.1 s.
⚠️ Both AVDs ran in **pure software emulation**, because this machine exposes no `/dev/kvm`
(`-accel off -no-window -gpu swiftshader_indirect`): ≈3 min to boot and 1–12 s per screenshot.
`hide_error_dialogs` was turned on and animations off, because under software emulation SystemUI
raises an ANR dialog that would otherwise sit in frame. Full recipe:
[STORE_LISTING](STORE_LISTING.md) › Screenshots › 7-inch and 10-inch tablets.
- [ ] Category: *Tools* (or *Photography* — pick it **before** the tags, because it shapes the - [ ] Category: *Tools* (or *Photography* — pick it **before** the tags, because it shapes the
*Suggested tags* list). Tags: **max 5, from Play's own list, not typed freely — and only two *Suggested tags* list). Tags: **max 5, from Play's own list, not typed freely — and only two
are honest for this app: *Photography*, plus optionally *Privacy & security*.** Play's are honest for this app: *Photography*, plus optionally *Privacy & security*.** Play's
@@ -129,6 +175,13 @@ action except the items marked **[code]**.
- *Is all user data encrypted in transit?* → N/A (no transmission). - *Is all user data encrypted in transit?* → N/A (no transmission).
- *Do you provide a way for users to request data deletion?* → Uninstalling - *Do you provide a way for users to request data deletion?* → Uninstalling
removes all app data. removes all app data.
- The **paid** model changes none of the above: the purchase happens in the Play Store app, not in
this one. Play's own guidance is that using a payment service such as *"Google Play's billing
system"* to complete transactions does **not** require declaring the data that service collects
in connection with its processing — and this app contains no payment code at all, so it receives
nothing either way. Re-read that if a Billing dependency is ever added
(step 9); the app's own answers would still be "no", but the *purchase handling* would move
into the app and the answers would need a fresh look.
- [x] Confirm the **permission set** the Console will show. **[code]** done 2026-10-13: `aapt2 dump - [x] Confirm the **permission set** the Console will show. **[code]** done 2026-10-13: `aapt2 dump
badging` on the release APK reports exactly the table below (plus badging` on the release APK reports exactly the table below (plus
`…DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION`) — and **no `INTERNET`**. Re-check from the `…DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION`) — and **no `INTERNET`**. Re-check from the
@@ -159,17 +212,95 @@ action except the items marked **[code]**.
(Match `<uses-permission` only. A bare `android.permission.` grep also picks up (Match `<uses-permission` only. A bare `android.permission.` grep also picks up
`android.permission.DUMP`, which AndroidX puts on its profile-installer *receiver* — `android.permission.DUMP`, which AndroidX puts on its profile-installer *receiver* —
a component restriction, not a permission the app requests.) a component restriction, not a permission the app requests.)
- [ ] Answer the **Photo and video permissions** declaration in the Console. The app - [ ] Answer the **Photo and video permissions** declaration (App content › Photo and video
requests `READ_MEDIA_IMAGES` (plus `READ_MEDIA_VISUAL_USER_SELECTED` for Android 14 permissions). It lists `READ_MEDIA_IMAGES` as *undeclared* and asks one question per
partial access) and deletes only user-selected files through the system dialog. permission — in a box with a hard **250-character** limit:
Paste:
> **Read media images** — Describe why the Android photo picker or other system pickers do
> not fully support your app's core functionality, and why your app needs to use the
> `READ_MEDIA_IMAGES` permission.
Paste — **243** of the 250 characters, pure ASCII so the count cannot drift on paste:
> The app needs READ_MEDIA_IMAGES to read every photo, because duplicate detection compares
> each photo with every other. A picker exposes only selected files, and a photo's duplicates
> are exactly the files it withholds. All hashing is on-device.
One sentence carries the whole argument: the reason the permission is needed *is* the reason
the picker cannot work. A picker hands over the files the user selected, and duplicates are
by definition the files nobody selected — the copies of a picked photo live in the part of
the library the picker never exposes. The closing sentence is there because a permission
declaration is also a privacy statement, and 25 characters is a cheap way to say it. If you
would rather open with the comparison than with the permission, this fits too (**228**):
> Finding duplicates requires comparing every photo with every other, so the app must read
> the whole library via READ_MEDIA_IMAGES. A picker exposes only selected files, and a
> photo's duplicates are exactly the files it withholds.
The longer versions below are kept for anywhere that is *not* capped at 250 — Play sometimes
follows up by email, and both read well wherever more detail is wanted. **1 689 characters**:
> Foto Dup Finder's core functionality is finding duplicate and visually similar photos
> across the user's whole photo library, and letting the user delete the copies. Reading the
> photo library is that entire operation.
>
> The Android photo picker cannot support it. The picker only grants access to the items the
> user selects in that session, and the duplicates are by definition outside that selection:
> the copies of a picked photo are other files, in other folders, that the picker never hands
> over. Comparing only the picked items tells the user nothing they did not already know;
> finding the groups requires comparing every photo in the library with every other photo.
>
> The app also needs the whole library to calibrate itself. It estimates the distance
> distribution of unrelated photos from the library's own pairwise perceptual-hash distances
> and sets the widest similarity threshold whose expected number of accidental matches stays
> in budget. Below a few hundred pairs that fit is impossible and the app falls back to a
> default; over a hand-picked subset it would be meaningless, because a selection is not a
> sample of the library — it is the part the duplicates are not in.
>
> Nothing is uploaded: the app declares no INTERNET permission and all hashing happens on the
> device. Photos are only read. Any deletion requires an explicit selection by the user and
> always goes through Android's own confirmation dialog (`MediaStore.createDeleteRequest` /
> `createTrashRequest`) — never silently — and the app never requests
> `MANAGE_EXTERNAL_STORAGE`. Partial access (`READ_MEDIA_VISUAL_USER_SELECTED`) is declared
> and supported as a reduced mode for users who prefer to hand over fewer photos.
…and **682 characters**, for a box with less room than that:
> Foto Dup Finder's only function is finding duplicate and similar photos across the user's
> whole photo library and letting them delete the copies: reading the library is the feature.
> The Android photo picker grants access only to the items a user selects, while the
> duplicates of a picked photo are precisely the files the picker never hands over — a
> selection cannot answer "what is duplicated in my library". The app also calibrates its
> similarity threshold from the library's own pairwise distance distribution, which needs the
> whole library to mean anything. Nothing is uploaded (the app has no INTERNET permission)
> and deletion always goes through Android's confirmation dialog.
Nothing in any of them is aspirational — every claim is a place in the code, so it can be
defended if Play comes back with questions:
| The answer claims … | … and this is where that is true |
|---|---|
| the app reads the whole library | `MediaStorePhotoSource.loadPhotos()` queries the image collection with a `null` selection — metadata only, pixels later and lazily |
| duplicate detection needs every pair | `DuplicateGrouper` clusters by exact SHA-256 *and* perceptual fingerprints, union-find over the whole scan |
| the threshold is fitted per library | `AdaptiveThreshold.choose()` estimates the unrelated-photo distribution from the scan's own pairwise histogram and returns the widest threshold keeping the *expected* number of accidental matches in budget; under `MIN_SAMPLE` = 200 pairs it falls back to the policy ceiling |
| a selection cannot stand in for a library | that histogram is built from every pair in the scan — the phone's 5,385-photo library fitted to *pHash ≤ 10 bits* and said so on screen, while the 22-photo tablet library was too small to fit and used its ceiling (`(default)`) |
| a constant threshold cannot work | `AdaptiveThreshold` KDoc and README § scan pipeline: the widest pHash threshold with zero false pairs falls from **13 (120 images) to 5 (2 880)** as a library grows |
| nothing leaves the device | no `INTERNET` in the merged release manifest — the `aapt2` audit in the item above |
| deletion is never silent | `MediaDeleter` → `MediaStore.createDeleteRequest` / `createTrashRequest`; no `MANAGE_EXTERNAL_STORAGE` |
| partial access is real, not a gesture | `AppPermissions.MediaAccess.PARTIAL` / `hasPartialAccess()`, with a banner and a prompt to upgrade to full access |
Three notes for filling the form in. (1) The declaration asks about `READ_MEDIA_IMAGES` only:
`READ_MEDIA_VISUAL_USER_SELECTED` is the *narrow* half of the pair and needs no justification,
so do not volunteer it as though it were the broad one. (2) If that screen also asks for a
**video**, the recorded foreground-service demo does show a full 5,385-photo library scan and
the groups it found, which is the functionality this declaration is about — but it was filmed
to answer the foreground-service question, so it is a fallback rather than the intended
answer, and a take focused on this question (open → grant → scan → groups) may be asked for.
(3) If the declaration were refused, the app already runs in the partial mode it implements
(banner + subset scan), so nothing would need rewriting — what would be lost is the promise
("find the duplicates you forgot about"), which is why the answer above is the one to stand
behind.
> Foto Dup Finder is a photo-cleanup tool. Reading the photo library **is** its core
> functionality: it compares photos on the device to find exact and near duplicates
> and lets the user remove the copies they select. Nothing is uploaded — the app
> declares no network permission. Deletion always goes through the system consent
> dialog (`MediaStore.createDeleteRequest`); the app never requests
> `MANAGE_EXTERNAL_STORAGE`.
- [ ] Declare the **foreground service type**. This is the release-blocking item for the - [ ] Declare the **foreground service type**. This is the release-blocking item for the
Android 14+ review. **[code]** The manifest already matches what you will declare: Android 14+ review. **[code]** The manifest already matches what you will declare:
@@ -181,14 +312,126 @@ action except the items marked **[code]**.
| `ScanService.kt` | `ServiceCompat.startForeground(…, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)` | | `ScanService.kt` | `ServiceCompat.startForeground(…, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)` |
| `ScanService.kt` | `onTimeout()` stops the scan at Android 15's 6-hour `dataSync` cap | | `ScanService.kt` | `onTimeout()` stops the scan at Android 15's 6-hour `dataSync` cap |
In the Console go to **App content › Foreground service permissions**, select The declaration page asks for **four** things per type, not one. Go to
**Data sync**, and paste: **App content › Foreground service permissions**:
1. **Description** of the app functionality using the type:
> The app finds duplicate photos on the device. The user starts a scan and may leave > The app finds duplicate photos on the device. The user starts a scan and may leave
> the app while it runs; the foreground service keeps that user-initiated scan alive > the app while it runs; the foreground service keeps that user-initiated scan alive
> and shows its progress. The scan reads the photo library and writes a small local > and shows its progress. The scan reads the photo library and writes a small local
> index of file hashes. It performs no network access and transfers no data. > index of file hashes. It performs no network access and transfers no data.
2. **User impact if the task is deferred or interrupted.** A scan is not deferrable work —
the user is watching for a result — so there is no WorkManager/JobScheduler fallback:
> If the scan were deferred, tapping "Start scan" would appear to do nothing and the
> user would have to keep the app open for the work to begin at all. If it were
> interrupted, the user would lose the progress of a whole-library comparison and
> have to start again. Only reads are involved, so an interruption cannot lose or
> corrupt data; the service stops as soon as the scan finishes or is cancelled, and
> it is held only for the duration of the scan.
3. **Use case**: **Local processing › Other.** The Console puts three options under *Local
processing*, and the other two do not describe this app. *Media transcoding* means
converting media into a different format — the app writes no media file at all, it only
reads photos to hash and compare them. *Importing, exporting* means moving files in or
out of the app — the app's only write is its own private index of file hashes, which no
other app ever sees. Play's wording for *Other* is *"Use for specifically user-initiated
work and not for regular system or server-initiated tasks"*, which is exactly a scan the
user taps *Start scan* for. This is not a cosmetic choice: an inaccurate use case is a
misdeclaration, and the description and the video have to back up whichever option is
picked — "reads the photo library and writes a small local index of file hashes" only
fits *Other*.
4. **A link to a video** demonstrating the feature — *"The video should demonstrate the
steps the user needs to take in your app in order to trigger the feature."*
**Recorded on the test device** (Android 12 / MIUI, `2a2ae895`) on 2026-10-14 with:
```bash
INSTALL=0 WARMUP=0 ./tools/record-fgs-demo.sh 2a2ae895
```
The output is `store-assets/fgs-demo/foreground-service-demo.mp4` (**committed**, so it is
already published; the checkpoint PNG per milestone beside it stays git-ignored). It was
checked frame by frame afterwards rather than assumed: the intro at 0 s, the scan starting
(*"Comparing file signatures… 91/102"*, 8 s), the shade held open for ~6 s with the live
notification (*"Finding duplicate photos / Looking for visually similar photos… /
CANCEL"*, 13–18 s) while the scan kept running behind it, and the finished results
(*17 duplicate groups · 54 of 5,385 photos*) at the end.
**The link to paste** is the file's page in Gitea — what the repository's own *view* of
the file opens, and what plays it:
```
https://gitea.softwareapp-hb.de/fishfacegit/foto-duplicate-finder/src/branch/main/store-assets/fgs-demo/foreground-service-demo.mp4
```
⚠️ **Not the `/raw/` URL**, even though that is the file itself. Gitea answers raw
responses with `Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline';
sandbox` — a deliberate guard against raw HTML and SVG — and that blocks the media load of a
document that navigates straight to a video: the tab stays blank with no error, which is
exactly how this behaved in a browser. The same URL is fine as a *subresource*: the page
above embeds `<video controls src="…/raw/branch/main/…mp4">`, which is why previewing the
file plays it and opening `/raw/` does not. Use `/raw/` for `curl` and downloads, never as
the link in the form.
Verified about the **page** URL: **200** anonymously, containing that `<video controls>`
element. Verified about the **raw** URL, from outside this network and unauthenticated:
**200**, `Content-Type: video/mp4`, `Content-Length: 1847900`, `Content-Disposition:
inline`, bytes sha256-identical to the recording, and `Range: bytes=0-99` → **206** with
exactly those 100 bytes although `Accept-Ranges` is not advertised (which matters because
`screenrecord` writes the `moov` atom at the very end of the file). Two things to know
before pasting: the URL is pinned to `main`, so a re-shoot has to **overwrite the file in
place** rather than be added alongside it; and replacing the video at all means resubmitting
the declaration.
If a link with no Gitea chrome around the player is preferred later, there are two ways and
neither is needed for the declaration: an unlisted YouTube upload of the same file, or a
rule on the Gitea host's Caddy proxy dropping the header for this one path
(`@fgsdemo path …/store-assets/fgs-demo/*.mp4` plus `header_down @fgsdemo
-Content-Security-Policy`) — **scoped to `store-assets/` only**, since that header is what
makes raw HTML and SVG safe to serve. Neither was tried from here.
Both flags exist because this take found two traps worth knowing before a re-shoot:
- **`WARMUP=0` keeps the *cold* scan on camera.** A warm scan of this library takes
**5.4 s**, which is less than the notification shade takes to open — so the first take
filmed an empty shade, convincingly. The cold first scan (~20 s) is what gives the
shade time to appear while the notification is still live, and reinstalling the app
restores that window.
- **`INSTALL=0` skips the install**, because MIUI does not let `adb` install anything:
the command **hangs** waiting for two prompts on the device — Google Play Protect
(*"App zum Sicherheitsscan senden?"*) and then MIUI's own *Installieren* — and
auto-cancels as `INSTALL_FAILED_USER_RESTRICTED` if they go unanswered. The simplest
route is to install once by hand and then record with `INSTALL=0`.
A hand recording is just as valid and needs no tooling: every Android 11+ phone has a
screen recorder in the quick settings, and the whole video is six steps — the intro, tap
*Start scan* (the trigger the declaration asks to see), press Home, pull the shade down
and leave the notification sitting there while the scan runs, tap the app back for the
results, stop. Under two minutes and uncut: a reviewer has to be able to follow the
trigger and see the service still working once the app has left the screen.
⚠️ **MIUI blocks synthetic input until the matching developer option is on.** Every
`adb shell input tap` on this phone fails with *"Injecting to another application
requires INJECT_EVENTS permission"* — which is why the project's earlier captures were all
taken by hand. With **USB debugging** enabled (and the security-settings toggle that comes
with it) the block lifts, `tools/record-fgs-demo.sh` drives the phone end to end and
nothing is needed from a human. Toggling it resets the USB connection, though: the device
comes back on a **new** `/dev/bus/usb` node, which has to be made readable before `adb`
sees it again.
⚠️ **It cannot be recorded on a KVM-less emulator**, and the failure is the platform's,
not the app's: every scan start there ends in
`am_crash … ForegroundServiceDidNotStartInTimeException` → *Force finishing activity*,
with no `am_kill` or low-memory record, because software emulation is too slow to get
from `startForegroundService()` to `startForeground()` inside Android's budget. QEMU's
virtual instruction counter dilates the guest clock and made it work exactly once
(`-qemu -icount shift=1,sleep=off`, guest clock measured 2.30× slow) but not
reproducibly, so that is a lead rather than a recipe; `SETTLE_SECONDS` / `WARM_SECONDS`
scale this script's waits if it is ever retried.
The declaration is **per type**: if a new foreground-service type is ever added to The declaration is **per type**: if a new foreground-service type is ever added to
the manifest, it has to be declared here too. the manifest, it has to be declared here too.
- [ ] Complete the **content rating** questionnaire (no objectionable content → - [ ] Complete the **content rating** questionnaire (no objectionable content →
@@ -197,6 +440,28 @@ action except the items marked **[code]**.
account, nothing gated. account, nothing gated.
- [ ] **Ads** → *No, my app does not contain ads* (and no ad SDK in - [ ] **Ads** → *No, my app does not contain ads* (and no ad SDK in
`gradle/libs.versions.toml` to contradict the answer). `gradle/libs.versions.toml` to contradict the answer).
- [ ] **Advertising ID** → *No, my app does not use advertising ID.* The question adds "This
includes any SDKs that your app imports that use advertising ID", so the answer has to come
from the dependency graph rather than from the source: `play-services-ads-identifier` is what
provides the ID and it merges `AD_ID` into the manifest on its own, so adding any ad or
analytics SDK would flip this answer to *Yes* without one line of app code changing. Audited
2026-10-14 against the shipped artefacts rather than against intentions:
| Check | Command | Result |
|---|---|---|
| no advertising/analytics SDK, direct **or transitive** | `./gradlew --offline -q :app:dependencies --configuration releaseRuntimeClasspath \| grep -iE 'gms\|firebase\|ads\|billing\|play-services'` | no output |
| no `AD_ID` and no Privacy Sandbox permission in the release APK | `aapt2 dump badging app/build/outputs/apk/release/app-release.apk \| grep -i permission` | exactly the audit table above — 7 requested, plus the framework's `…DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION` |
| the same for the **`.aab`**, which is the artefact Play scans | `unzip -p app/build/outputs/bundle/release/app-release.aab base/manifest/AndroidManifest.xml \| strings \| grep -x 'AD_ID'` | 0 hits |
| no Play Services classes in the shipped code | `unzip -p app/build/outputs/apk/release/app-release.apk classes.dex \| grep -a -c 'com/google/android/gms'` | 0 |
| nothing could be sent even if an ID were read | the permission audit above | no `INTERNET` |
This is the machine-checked version of what [PRIVACY.md](../PRIVACY.md) promises in words
("does not collect … advertising identifiers", "does not contain advertising SDKs or
third-party trackers"), so re-run the first two rows after **any** dependency change —
including one that looks unrelated. This is the declaration a stray library can answer
wrongly on the app's behalf, and the *Data safety* form's *Device or other IDs* answer is
*No* for the same reason.
- [ ] Select the target audience (not designed for children). - [ ] Select the target audience (not designed for children).
- [ ] Answer the remaining *App content* declarations **No** / not applicable: news app, - [ ] Answer the remaining *App content* declarations **No** / not applicable: news app,
government app, financial features, health, COVID-19 contact tracing. government app, financial features, health, COVID-19 contact tracing.
@@ -282,13 +547,25 @@ Ready-to-paste block for **1.0.1** (the scan-robustness patch):
- [ ] Optionally add crash reporting later — but note this would change the Data - [ ] Optionally add crash reporting later — but note this would change the Data
safety answers, so weigh it against the "no data leaves the device" promise. safety answers, so weigh it against the "no data leaves the device" promise.
## 9. Optional monetisation ## 9. Monetisation — decided: one-time paid app, no billing
The app currently has no ads and no billing, which is a deliberate differentiator. **The decision is made: Foto Dup Finder is a one-time paid app** (rationale, the €2.99 base price,
If you later add a paid tier, use **Play Billing** (e.g. a one-time "Pro" the €1.49 launch sale and the irreversibility rule: [STORE_LISTING](STORE_LISTING.md) › App pricing).
purchase) and update: The Console work is in step 4; **nothing in this repository changes**, because a price on the listing
- the Data safety form (purchase history), adds no code, no permission and no Data Safety answer — which is exactly what a free app with a Pro
- the privacy policy, unlock could not claim.
- the store description.
Avoid ad SDKs entirely — they would contradict the app's main selling point. Standing rules:
- **Ads: never.** Every ad SDK needs the `INTERNET` permission to fetch anything, and the
merged-manifest check in step 5, [PRIVACY.md](../PRIVACY.md) and the Data Safety answers all rest
on that permission being absent.
- **In-app purchases: deliberately absent.** If that ever changes, the requirement is Play Billing
**8+** (latest published: 9.1.0, with an extension available to Nov 1, 2026). Worth knowing before
the decision is re-litigated: the **Billing Library itself does not add `INTERNET`** —
`com.android.billingclient:billing:9.1.0`'s manifest declares only `com.android.vending.BILLING`
and `<queries>` for the billing service, which was checked by unpacking the AAR. What *would*
change is the store copy (the "pay once" line), `PRIVACY.md`, the acknowledgement/restore flow, and
the fact that a purchase can only be verified on an internal testing track — never locally.
- **Refunds and support** follow Play's policy for a paid app; keep the contact address in
[PRIVACY.md](../PRIVACY.md) current.
+13 -6
View File
@@ -20,8 +20,8 @@ Legend: ✅ done · 🚧 in progress · ⏳ not started · 💡 candidate (propo
| M6 | Release config & Play readiness | ✅ | R8/minify, optional signing, `.aab`, [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md), [PRIVACY.md](../PRIVACY.md), README | | M6 | Release config & Play readiness | ✅ | R8/minify, optional signing, `.aab`, [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md), [PRIVACY.md](../PRIVACY.md), README |
| M7 | On-device validation & hardening | ✅ | Foreground `dataSync` service, one failure boundary per file, `core/DecodeMath`, hostile fixtures ([EDGE_CASE_TESTING](EDGE_CASE_TESTING.md)), `versionName` → 1.0.0 | | M7 | On-device validation & hardening | ✅ | Foreground `dataSync` service, one failure boundary per file, `core/DecodeMath`, hostile fixtures ([EDGE_CASE_TESTING](EDGE_CASE_TESTING.md)), `versionName` → 1.0.0 |
| M8 | Localisation groundwork | ✅ | Every user-visible string in `res/values/strings.xml` with real `<plurals>`, shared `text/TextRes.kt`; **English is the only locale** | | M8 | Localisation groundwork | ✅ | Every user-visible string in `res/values/strings.xml` with real `<plurals>`, shared `text/TextRes.kt`; **English is the only locale** |
| M9 | Monetisation | ⏳ | No billing code. Blocked on a product decision (free forever vs. one-time unlock vs. limited free scans); changes the Data Safety answers | | M9 | Monetisation | ✅ | **Decided: a one-time paid app** — no free tier, no trial, no subscription and no in-app purchase, so there is **no Billing code** and no new permission. Checked before deciding: `com.android.billingclient:billing:9.1.0`'s manifest declares only `com.android.vending.BILLING`, so IAP would *not* have added `INTERNET` either — but a price on the listing is the one model that changes nothing at all about the "no internet permission" claim. Base price **€2.99** one-time with a **50% launch sale at €1.49**, both set in the Console (*Products > App pricing*). €1 as the *base* price was considered and rejected: a sale can always be added, but a low anchor cannot be undone, and a paid app's first transaction is its only transaction. Free → paid becomes impossible after the first upload, so this had to be settled before release. Rationale, copy changes and Console steps: [STORE_LISTING](STORE_LISTING.md) › App pricing, [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) step 4 |
| M10 | Store assets | ✅ | `tools/make-store-assets.sh` renders the 512×512 icon and the 1024×500 feature graphic from the app's own vectors; `tools/make-store-screenshots.sh` normalises device captures to Play's 2:1 limit (1080×2160); `tools/make-demo-photos.py` generates the photo library the results capture is taken over, so no real photos are published; all listing copy is drafted and length-checked in [STORE_LISTING](STORE_LISTING.md). Four screenshots (empty, scanning, results, Options) were re-shot after a real permission grant and normalised to 1080×2160; screenshots are deliberately not committed | | M10 | Store assets | ✅ | `tools/make-store-assets.sh` renders the 512×512 icon and the 1024×500 feature graphic from the app's own vectors; `tools/make-store-screenshots.sh` normalises device captures to Play's 2:1 limit, one directory per form factor (`phone` → 1080×2160, `tablet-7in` → 1200×1920, `tablet-10in` → 1600×2560); `tools/make-demo-photos.py` generates the photo library the results captures are taken over, so no real photos are published; all listing copy is drafted and length-checked in [STORE_LISTING](STORE_LISTING.md). The phone set was re-shot on a real device after a real permission grant, and the two tablet sets were captured on AOSP AVDs (see the blocker below); the finished assets — icon, feature graphic, the twelve normalised screenshots and the demonstration video — are committed, so Gitea serves them publicly and pushing is the deployment step |
## Release blockers (work that is not a numbered milestone) ## Release blockers (work that is not a numbered milestone)
@@ -29,9 +29,10 @@ Legend: ✅ done · 🚧 in progress · ⏳ not started · 💡 candidate (propo
|---|---| |---|---|
| ~~Large-library scan stall~~ ✅ **fixed — verified on device** | The 5,363-photo library used to freeze at *“74 / 100 · Comparing file signatures…”* (a **blocked syscall**: zero CPU, workers sleeping). `BoundedCall` now abandons a stuck provider call **and** trips a stall breaker after three consecutive timeouts. **Verified on the real test device (Android 12 / MIUI): the scan completes — 20.2 s cold, 11.0 s warm, 15 groups, 6 unreadable — where it used to hang.** Covered by `BoundedCallTest` and `ScanEngineEndToEndTest` | | ~~Large-library scan stall~~ ✅ **fixed — verified on device** | The 5,363-photo library used to freeze at *“74 / 100 · Comparing file signatures…”* (a **blocked syscall**: zero CPU, workers sleeping). `BoundedCall` now abandons a stuck provider call **and** trips a stall breaker after three consecutive timeouts. **Verified on the real test device (Android 12 / MIUI): the scan completes — 20.2 s cold, 11.0 s warm, 15 groups, 6 unreadable — where it used to hang.** Covered by `BoundedCallTest` and `ScanEngineEndToEndTest` |
| ~~Unreleased `BoundedCall` fix~~ ✅ | The provider-call deadline shipped in **1.0.1** (`versionCode` 2) | | ~~Unreleased `BoundedCall` fix~~ ✅ | The provider-call deadline shipped in **1.0.1** (`versionCode` 2) |
| **Play Console: foreground-service declaration** | Declaring the `dataSync` type (App content › Foreground service permissions) is release-blocking. **[code]** the manifest already declares it; the ready-to-paste justification is in [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) step 5 — this is a Console action, not a code change | | **Play Console: foreground-service declaration** | Declaring the `dataSync` type (App content › Foreground service permissions) is release-blocking. **[code]** the manifest already declares it, [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) step 5 carries all four things the form asks for (description, defer/interrupt impact, use case **Local processing: Other**, video link), and the **video now exists**: recorded on the test device on 2026-10-14 with `INSTALL=0 WARMUP=0 tools/record-fgs-demo.sh`, then verified frame by frame rather than assumed — intro at 0 s, the scan starting, **~6 s of the shade with the live "Finding duplicate photos / Looking for visually similar photos… / CANCEL" notification while the scan kept running**, and the results at the end. It is committed, and that is what published it — the link is the file's **page** in Gitea (`/src/branch/main/…`), which plays it anonymously. The `/raw/` URL is deliberately not the link: Gitea sends `Content-Security-Policy: default-src 'none'` with raw responses, so a browser navigating to the video sits on a blank tab even though the bytes are perfect. Pasting the page URL into the declaration is all that is left. Two details of the take are recorded in step 5 because they each cost an attempt: a *warm* scan is 5.4 s, shorter than the shade takes to open, so `WARMUP=0` films the cold one; and MIUI refuses `adb install` outright, so `INSTALL=0` records with the build already on the device. On a KVM-less emulator the same video cannot be made at all: every scan start dies as `am_crash … ForegroundServiceDidNotStartInTimeException` → *Force finishing activity* with no `am_kill`, i.e. emulation is too slow to reach `startForeground()` inside Android's budget (QEMU's `-icount` clock dilation made it work once, not reproducibly) |
| **Remaining Play paperwork** | Console actions only, no code: the **first upload + Play App Signing enrolment**, the **hosted privacy policy URL** (the working copy is now published to Gitea as [`fishfacegit/foto-duplicate-finder`](https://gitea.softwareapp-hb.de/fishfacegit/foto-duplicate-finder), so the policy renders at a public, login-free URL and only the Console paste is left), **Data safety**, the **Photo/video permissions** declaration, the **content rating / audience / app access / ads / export** questions, and the **listing copy + four screenshots**. Keystore, `versionCode`, listing copy, graphics, permission audit and the signed `.aab` (`sha256 f8e6a29a…`) are all in place; rollout goes internal → closed → production. Step-by-step: [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) | | **Remaining Play paperwork** | Console actions only, no code: the **first upload + Play App Signing enrolment**, the **hosted privacy policy URL** (the working copy is now published to Gitea as [`fishfacegit/foto-duplicate-finder`](https://gitea.softwareapp-hb.de/fishfacegit/foto-duplicate-finder), so the policy renders at a public, login-free URL and only the Console paste is left), **Data safety**, the **Photo/video permissions** declaration, the **content rating / audience / app access / ads / advertising ID / export** questions, and the **listing copy + the three screenshot sets** (phone, 7-inch and 10-inch, all captured), plus the **paid-app setup**: a payments profile with tax rates, the €2.99 price and the 14-day €1.49 launch sale on *Products > App pricing* — the price must be set before the first upload, because free → paid is not possible afterwards (M9). Keystore, `versionCode`, listing copy, graphics, permission audit and the signed `.aab` (`sha256 f8e6a29a…`) are all in place; rollout goes internal → closed → production. Step-by-step: [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) |
| ~~Store screenshots need one re-shoot~~ ✅ **done — verified on device** | The old captures showed the *Photo access needed* banner (an app-op is not a grant) and `03-results.png` showed the developer's own library. After a real grant the set was re-shot over the generated demo library: **01-empty** (no tap needed — results and selection live in `ScannerViewModel`, so force-stop + relaunch returns to the empty state with the grant still in place), **02-scanning** (`5353 / 5385`), **03-results** (**17 groups, 54 of 5385 photos, 83.5 MB reclaimable**; the headline group's 43.1 MB out-ranks the device's own 39.8 MB, so no real photo is in frame) and **04-options**. Captures are taken by watching for UI **text** changes, because MIUI refuses synthetic taps (`INJECT_EVENTS`). The demo library is deleted from the test device afterwards — MediaStore **5,386 → 5,364** rows, and the 22 stale rows it leaves in the hash index are pruned by `PhotoIndexStore.pruneTo` on the next scan. Deliberately not captured: the staged state and the system confirmation dialog, because staging clears the demo group and would put real photos back in frame. Details: [STORE_LISTING](STORE_LISTING.md) | | ~~Store screenshots need one re-shoot~~ ✅ **done — verified on device** | The old captures showed the *Photo access needed* banner (an app-op is not a grant) and `03-results.png` showed the developer's own library. After a real grant the set was re-shot over the generated demo library: **01-empty** (no tap needed — results and selection live in `ScannerViewModel`, so force-stop + relaunch returns to the empty state with the grant still in place), **02-scanning** (`5353 / 5385`), **03-results** (**17 groups, 54 of 5385 photos, 83.5 MB reclaimable**; the headline group's 43.1 MB out-ranks the device's own 39.8 MB, so no real photo is in frame) and **04-options**. Captures are taken by watching for UI **text** changes, because MIUI refuses synthetic taps (`INJECT_EVENTS`). The demo library is deleted from the test device afterwards — MediaStore **5,386 → 5,364** rows, and the 22 stale rows it leaves in the hash index are pruned by `PhotoIndexStore.pruneTo` on the next scan. Deliberately not captured: the staged state and the system confirmation dialog, because staging clears the demo group and would put real photos back in frame. Details: [STORE_LISTING](STORE_LISTING.md) |
| ~~Tablet store screenshots outstanding~~ ✅ **done — captured on AVDs** | Play has a **7-inch tablet** and a **10-inch tablet** screenshot slot of its own (asking for **≥ 4** screenshots on large screens). Both are now captured on AOSP Android 12 AVDs — `Nexus 7 2013` (1200×1920, `sw600dp`) and `medium_tablet` (1600×2560, `sw800dp`) — because this machine exposes no `/dev/kvm`: they ran in **pure software emulation** (`-accel off -no-window -gpu swiftshader_indirect`), ≈3 min to boot, with `hide_error_dialogs` on so SystemUI's ANR dialog could not sit in frame. Four screens per tablet over the same generated demo library: empty, scanning (20 / 22), results (**2 groups · 16 of 22 photos · 43.7 MB reclaimable**, 39.7 s / 53.1 s) and Options. `tools/make-store-screenshots.sh` is form-factor aware (`FORM_FACTOR=phone\|tablet-7in\|tablet-10in`) and the tablet form factors crop **0 px** of chrome, because a tablet frame is already inside Play's 2:1 cap. Recipe: [STORE_LISTING](STORE_LISTING.md) |
| **Device-only verifications** | RAW/DNG files, a *real* iPhone HEIC with a non-upright EXIF orientation, permission revoked mid-scan, and the Android 14 “Selected photos” flow. ✅ The **index-reuse** check is done: after a scan the index holds **5,363 rows, 5,357 with a perceptual hash**, and a second scan runs in **11.0 s vs 20.2 s** cold | | **Device-only verifications** | RAW/DNG files, a *real* iPhone HEIC with a non-upright EXIF orientation, permission revoked mid-scan, and the Android 14 “Selected photos” flow. ✅ The **index-reuse** check is done: after a scan the index holds **5,363 rows, 5,357 with a perceptual hash**, and a second scan runs in **11.0 s vs 20.2 s** cold |
## Candidate milestones (proposed, not scheduled) ## Candidate milestones (proposed, not scheduled)
@@ -52,8 +53,14 @@ Legend: ✅ done · 🚧 in progress · ⏳ not started · 💡 candidate (propo
app's own vectors, the screenshot normaliser enforces Play's 2:1 limit, the listing copy is app's own vectors, the screenshot normaliser enforces Play's 2:1 limit, the listing copy is
drafted and length-checked, and the demo library that keeps real photos out of the results drafted and length-checked, and the demo library that keeps real photos out of the results
capture is generated and validated. The re-shoot after a real permission grant is done as well capture is generated and validated. The re-shoot after a real permission grant is done as well
(see blockers): four captures, normalised to 1080×2160. (see blockers): four captures, normalised to 1080×2160. The normaliser is form-factor aware too,
and the 7-inch and 10-inch tablet sets were captured on AOSP AVDs in software emulation
(1200×1920 and 1600×2560), so all three screenshot sets now exist.
4. **Colour signature** — the flat-colour false-positive fix. 4. **Colour signature** — the flat-colour false-positive fix.
5. **M9 — monetisation**, once the product decision is made. 5. ✅ **Done** — **M9 monetisation**: decided as a **one-time paid app (€2.99, launched with a 14-day
50% sale at €1.49)**, which needs no code at all. The remaining work is Console-only — a payments
profile, the price and the launch sale on *Products > App pricing* — and the price must happen
before the first upload, because free → paid stops being possible once the app has been offered
for free.
Deliberately deferred: **video support** and the **“similar shots”** section. Deliberately deferred: **video support** and the **“similar shots”** section.
+250 -17
View File
@@ -9,26 +9,62 @@ release.
## Graphics ## Graphics
Generated into `store-assets/` **inside the repository**, never into `$HOME`. The icon and the Generated into `store-assets/` **inside the repository**, never into `$HOME`, and **committed**:
feature graphic are the files that get uploaded to the Play Console, so they are committed and the icon, the feature graphic, the twelve normalised screenshots and the foreground-service
versioned with the release they belong to. **Screenshots are not committed** — neither the raw demonstration video all live in git, versioned with the release they belong to. That is deliberate
captures (`store-assets/raw-screenshots/`) nor the cropped ones (`store-assets/screenshots/`) — — Play wants a *link* to the demonstration video, so an asset has to be reachable without a login,
because a screenshot of this app is a picture of a photo library. Regenerate them with the and once one is, it is simpler to keep the whole listing beside the code that produces it.
commands below and upload them straight from disk.
Publishing them is safe because of where they are shot: every published frame contains the
**generated** demo library and nothing else (`tools/make-demo-photos.py`), so the screenshots show
the app *over* that library. The phone set was re-checked frame by frame before publication; the
sole trace of the test device's own 5,385-photo library in it is a count in the summary card. What
stays out of git is the scratch around them — the raw `adb` captures
(`store-assets/raw-screenshots/`), the demo photos themselves, and the recording script's milestone
PNGs. Regenerate any of it with the commands below and upload straight from disk.
Screenshots live **one directory per form factor**, because Play gives phones, 7-inch tablets and
10-inch tablets a slot each (`Main store listing` › *Graphics* › *Phone* / *7-inch tablet* /
*10-inch tablet*):
```
store-assets/raw-screenshots/{phone,tablet-7in,tablet-10in}/ git-ignored `adb` captures
store-assets/screenshots/{phone,tablet-7in,tablet-10in}/ the files that get uploaded — committed
```
```bash ```bash
./tools/make-store-assets.sh # icon + feature graphic -> store-assets/ ./tools/make-store-assets.sh # icon + feature graphic -> store-assets/
./tools/make-store-screenshots.sh # crop the adb captures -> store-assets/screenshots/ ./tools/make-store-screenshots.sh # phone -> screenshots/phone/
FORM_FACTOR=tablet-7in ./tools/make-store-screenshots.sh # 7-inch -> screenshots/tablet-7in/
FORM_FACTOR=tablet-10in ./tools/make-store-screenshots.sh # 10-inch -> screenshots/tablet-10in/
python3 tools/make-demo-photos.py # synthetic photo library -> demo-photos/ (git-ignored) python3 tools/make-demo-photos.py # synthetic photo library -> demo-photos/ (git-ignored)
``` ```
Committing `store-assets/` is also what *publishes* it: Gitea serves every committed file without a
login, and pushing the commit **is** the deployment step — there is no separate upload, so a
re-shot screenshot or re-recorded video goes live the moment it is pushed. There are two URL shapes,
and which one is right depends on what does the reading:
```
https://gitea.softwareapp-hb.de/fishfacegit/foto-duplicate-finder/raw/branch/main/<path> the bytes — curl, downloads
https://gitea.softwareapp-hb.de/fishfacegit/foto-duplicate-finder/src/branch/main/<path> a page — what a browser opens
```
For media that distinction is not cosmetic: Gitea sends `Content-Security-Policy: default-src
'none'` with `/raw/` responses, so a video opened at a raw URL shows a blank tab, while the same file
plays on its `src` page. Play's foreground-service declaration therefore takes the **page** URL as
its video link; the reasoning and what was verified about both URLs are in
[PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) step 5.
| Asset | Play's spec | Result | Source | | Asset | Play's spec | Result | Source |
|---|---|---|---| |---|---|---|---|
| App icon | 512×512, 32-bit PNG with alpha, ≤ 1 MB | `store-assets/icon-512.png` — 512×512, RGBA, 6 KB | `tools/store-assets/icon.svg`, mirrored from `app/src/main/res/drawable/ic_launcher_background.xml` + `ic_launcher_foreground.xml` (paths and group transforms are identical, so the store icon *is* the launcher icon) | | App icon | 512×512, 32-bit PNG with alpha, ≤ 1 MB | `store-assets/icon-512.png` — 512×512, RGBA, 6 KB | `tools/store-assets/icon.svg`, mirrored from `app/src/main/res/drawable/ic_launcher_background.xml` + `ic_launcher_foreground.xml` (paths and group transforms are identical, so the store icon *is* the launcher icon) |
| Feature graphic | 1024×500, JPEG or 24-bit PNG without alpha | `store-assets/feature-graphic-1024x500.png` — 1024×500, RGB | `tools/store-assets/feature-graphic.svg` | | Feature graphic | 1024×500, JPEG or 24-bit PNG without alpha | `store-assets/feature-graphic-1024x500.png` — 1024×500, RGB | `tools/store-assets/feature-graphic.svg` |
| Phone screenshots | JPEG or 24-bit PNG without alpha, shorter side ≥ 320 px, longer side ≤ 3840 px, **longer side ≤ 2× shorter side** | `store-assets/screenshots/0{1,2,3,4}-*.png` — 1080×2160, RGB | `tools/make-store-screenshots.sh`, from raw `adb exec-out screencap` captures in `store-assets/raw-screenshots/` | | Phone screenshots | JPEG or 24-bit PNG without alpha, shorter side ≥ 320 px, longer side ≤ 3840 px, **longer side ≤ 2× shorter side** | `store-assets/screenshots/phone/0{1,2,3,4}-*.png` — 1080×2160, RGB | `tools/make-store-screenshots.sh`, from raw `adb exec-out screencap` captures in `store-assets/raw-screenshots/phone/` |
| 7-inch tablet screenshots | same image rules as phone, but Play asks for **at least 4 screenshots** per large-screen form factor and suggests a 16:9 landscape / 9:16 portrait frame | `store-assets/screenshots/tablet-7in/0{1,2,3,4}-*.png` — 1200×1920, RGB | `FORM_FACTOR=tablet-7in tools/make-store-screenshots.sh`, from `Nexus 7 2013` AVD captures in `store-assets/raw-screenshots/tablet-7in/` |
| 10-inch tablet screenshots | same image rules as phone; 4+ recommended | `store-assets/screenshots/tablet-10in/0{1,2,3,4}-*.png` — 1600×2560, RGB | `FORM_FACTOR=tablet-10in tools/make-store-screenshots.sh`, from `medium_tablet` AVD captures in `store-assets/raw-screenshots/tablet-10in/` |
Two details worth keeping in mind: Three details worth keeping in mind:
- The icon is **full bleed**: the adaptive-icon background covers all 108 dp, so every pixel - The icon is **full bleed**: the adaptive-icon background covers all 108 dp, so every pixel
of the PNG ends up opaque and Play's mask can crop to any shape without showing a gap. of the PNG ends up opaque and Play's mask can crop to any shape without showing a gap.
@@ -37,10 +73,19 @@ Two details worth keeping in mind:
navigation bar (130 px) and clamps to 1080×2160, which removes system chrome only, never navigation bar (130 px) and clamps to 1080×2160, which removes system chrome only, never
app content. Re-measure both insets if you shoot on another device and pass app content. Re-measure both insets if you shoot on another device and pass
`STATUS_BAR_PX` / `NAV_BAR_PX`. `STATUS_BAR_PX` / `NAV_BAR_PX`.
- A **tablet** frame has no such problem, which is why the tablet form factors default to
**0 px of crop**: every tablet profile the SDK ships is between 16:9 and 16:10 — 7" WSVGA is
1024×600, 10.1" WXGA is 1280×800, and Nexus 10 / Medium Tablet / Pixel Tablet are 2560×1600 —
so a tablet capture is already inside the 2:1 cap. Cropping the bars there is cosmetic, so it
is opt-in via `STATUS_BAR_PX` / `NAV_BAR_PX`. The 2:1 clamp still runs, which is what makes the
tool safe on a device whose frame *is* taller than 2:1.
## Screenshots ## Screenshots
Captured on the test device (1080×2400, Android 12 / MIUI), cropped to 1080×2160: ### Phone (1080×2160)
Captured on the test device (1080×2400, Android 12 / MIUI), normalised into
`store-assets/screenshots/phone/` at 1080×2160:
| File | Screen | | File | Screen |
|---|---| |---|---|
@@ -73,9 +118,105 @@ returns to the empty state with the grant still in place:
```bash ```bash
adb shell am force-stop de.softwareapp_hb.fotodup.finder.debug adb shell am force-stop de.softwareapp_hb.fotodup.finder.debug
adb shell am start -n de.softwareapp_hb.fotodup.finder.debug/de.softwareapp_hb.fotodup.finder.MainActivity adb shell am start -n de.softwareapp_hb.fotodup.finder.debug/de.softwareapp_hb.fotodup.finder.MainActivity
adb exec-out screencap -p > store-assets/raw-screenshots/01-empty.png adb exec-out screencap -p > store-assets/raw-screenshots/phone/01-empty.png
``` ```
### 7-inch and 10-inch tablets (1200×1920 and 1600×2560)
Play keeps a **separate screenshot slot per form factor**, so the phone set does not fill the tablet
rows: *Graphics* lists **Phone**, **7-inch tablet** and **10-inch tablet** (plus Chromebook, Android
TV, Wear OS, Automotive and XR, none of which this app ships to). For tablets and Chromebooks Play
asks for a **minimum of four** screenshots that "demonstrate your in-app experience" — up to 8 per
device type — under the same image rules as the phone slot (JPEG or 24-bit PNG, no alpha,
320–3840 px, longer side ≤ 2× shorter side), with a 16:9 landscape / 9:16 portrait frame *highly
recommended* rather than required.
Captured on two **AOSP Android 12 AVDs**, because there is no real tablet here: `Nexus 7 2013` for
the 7-inch slot (1200×1920 portrait, `sw600dp`, 320 dpi) and `medium_tablet` for the 10-inch slot
(1600×2560 portrait, `sw800dp`, 320 dpi). This machine exposes no `/dev/kvm`, so both ran in **pure
software emulation** (`-accel off -no-window -gpu swiftshader_indirect`): slow — about 3 minutes to
boot and 1–12 s per screenshot — but rendering, MediaStore and touch injection all behave.
| File | 7-inch — `tablet-7in/` | 10-inch — `tablet-10in/` | Screen |
|---|---|---|---|
| `01-empty.png` | 1200×1920 | 1600×2560 | Intro / empty state — access already granted, so there is no banner and *Start scan* is enabled |
| `02-scanning.png` | 1200×1920 | 1600×2560 | Scanning — *“Looking for visually similar photos…”* at **20 / 22**, live *Cancel* |
| `03-results.png` | 1200×1920 | 1600×2560 | Results over the demo library — **2 duplicate groups, 16 of 22 photos, 43.7 MB reclaimable** (scanned in **39.7 s** on the 7-inch, **53.1 s** on the 10-inch), `BEST` badge, selection bar |
| `04-options.png` | 1200×1920 | 1600×2560 | Options menu — the three sensitivity presets with the ✓ on *Balanced (recommended)*, and the trash-vs-permanent toggle |
The *14 selected · 43.7 MB* bar in `03-results.png` is not a staged tap: a finished scan auto-selects
*all but best* across every group (`ScannerViewModel.autoSelection`), so it **is** the screen's
default state — same as on the phone. The figures are the generated demo library's own (22 photos, 16
of them duplicates), not the phone capture's 5,385-photo ones. Nothing except the demo library was
ever pushed to either AVD, and it is deleted again after the captures, so no real photo can appear in
the tablet set.
Two things made the tablet captures cheap to take:
- **No chrome maths.** No tablet frame is anywhere near 2:1, so both tablet form factors default to
**0 px of crop** — the four tablet PNGs are exactly the frame `screencap` returned, only flattened
to 24-bit. Set `STATUS_BAR_PX` / `NAV_BAR_PX` only if you *want* the bars gone; measure them on the
tablet first, they are not the phone's 93/130.
- **No new screens.** The app has no large-screen branching at all: `res/` has no `values-sw600dp`
or `layout-sw600dp`, the UI code uses no `WindowSizeClass` / `BoxWithConstraints`, and the
activity has no `screenOrientation` lock — a tablet shows the same single-column scanner, wider.
The shot list is therefore the same four files, and portrait keeps the three sets parallel.
One knob needed no attention: a fresh AVD has an empty photo library, so the demo group is the biggest
one by construction and `--target-mb` needs no tuning — that only matters on a tablet that already
holds photos (see the demo-library section below).
`avdmanager` / `sdkmanager` / `emulator` live in `$ANDROID_SDK_ROOT` (`cmdline-tools/latest/bin` for
the first two). The device ids are the ones `avdmanager list device` reports: `Nexus 7 2013` is
1200×1920 xhdpi and `medium_tablet` is 2560×1600 xhdpi (Pixel Tablet class).
```bash
# 1. The two tablet AVDs (AOSP Android 12 images; ~4 GB of SDK downloads).
avdmanager create avd -n tablet7 -d "Nexus 7 2013" -k "system-images;android-31;default;x86_64"
avdmanager create avd -n tablet10 -d medium_tablet -k "system-images;android-31;default;x86_64"
# 2. Boot it. No KVM here, so: no window, no audio, SwiftShader, no snapshot, software CPU.
emulator -avd tablet7 -no-window -no-audio -no-boot-anim -no-snapshot \
-gpu swiftshader_indirect -accel off -memory 2048 -cores 4 &
# 3. Emulator housekeeping. Under TCG SystemUI is slow enough to raise an ANR dialog that would sit
# in frame, and `medium_tablet` boots landscape — portrait is rotation 3 on it, not 0.
adb shell settings put global hide_error_dialogs 1
adb shell settings put global window_animation_scale 0
adb shell settings put global transition_animation_scale 0
adb shell settings put global animator_duration_scale 0
adb shell settings put system accelerometer_rotation 0
adb shell settings put system user_rotation 3 # tablet10 only; the Nexus 7 is portrait-native
# 4. The phone set's prerequisites: the app, the permission, the demo library.
adb install -r app/build/outputs/apk/debug/app-debug.apk
adb shell pm grant de.softwareapp_hb.fotodup.finder.debug android.permission.READ_EXTERNAL_STORAGE
python3 tools/make-demo-photos.py
adb push demo-photos/foto-dup-demo /sdcard/DCIM/foto-dup-demo
adb shell content call --uri content://media --method scan_file --arg /sdcard/DCIM/foto-dup-demo
# 5. Capture. `01` is one screencap. The other three need a tap, so their coordinates come from
# `uiautomator dump` instead of guesswork, and a screencap burst *started before the tap* is what
# catches the short scanning screen — 22 photos scan in seconds even under emulation.
adb shell am force-stop de.softwareapp_hb.fotodup.finder.debug
adb shell am start -n de.softwareapp_hb.fotodup.finder.debug/de.softwareapp_hb.fotodup.finder.MainActivity
adb exec-out screencap -p > store-assets/raw-screenshots/tablet-7in/01-empty.png
# ... burst frames into /tmp, tap "Start scan" (7-inch 600 1155, 10-inch 800 1465), keep the frame
# showing "Looking for visually similar photos… N / 22" for 02 and the one after it for 03,
# then tap "Options" (7-inch 1118 112, 10-inch 1518 112) and keep the frame showing the menu.
# 6. Normalise — then repeat everything with FORM_FACTOR=tablet-10in on the tablet10 AVD.
FORM_FACTOR=tablet-7in ./tools/make-store-screenshots.sh
# 7. Take the demo library back off the AVD, exactly as on the phone.
adb shell rm -rf /sdcard/DCIM/foto-dup-demo
adb shell content call --uri content://media --method scan_file --arg /sdcard/DCIM/foto-dup-demo
```
The 16:10 frame a tablet produces (1200×1920 or 1600×2560) is inside Play's 2:1 cap but is not the
16:9/9:16 shape the *highly recommended* bullet asks for. Cropping app content to fake 9:16 would be
worse than missing a soft recommendation, so the captures go up as shot.
### Demo library: generated photos, so none of anyone's real ones are published ### Demo library: generated photos, so none of anyone's real ones are published
`03-results.png` is a screenshot *of a photo library*, so whatever is on the test device ends up `03-results.png` is a screenshot *of a photo library*, so whatever is on the test device ends up
@@ -140,14 +281,91 @@ MediaStore id, so there is nothing else to reset.
Two further screens were weighed up and deliberately left out of the set: the staged state (*“All Two further screens were weighed up and deliberately left out of the set: the staged state (*“All
duplicates are ready to go”*) after *Remove all selected*, and Android's confirmation dialog for the duplicates are ready to go”*) after *Remove all selected*, and Android's confirmation dialog for the
batch that *Apply* launches. Staging every selected row also clears the demo group out of the list, batch that *Apply* launches. Staging every selected row also clears the demo group out of the list,
which promotes the device's own 39.8 MB group into frame — so those captures could not be published, which promotes the device's own 39.8 MB group into frame — so those captures could not be committed
and since screenshots are not committed there would be nothing to keep them for. (Dismissing the or published. (Dismissing the dialog is non-destructive, so nothing is lost by not going that far.)
dialog is non-destructive, so nothing is lost by not going that far.)
Captures are taken by hand, because each of these screens needs a tap and MIUI only accepts taps from Captures are taken by hand, because each of these screens needs a tap and MIUI only accepts taps from
a human. A loop that takes a `uiautomator dump` and screencaps whenever the UI **text** changes is a human. A loop that takes a `uiautomator dump` and screencaps whenever the UI **text** changes is
enough, so the capture never depends on tap timing; that is how `04-options.png` was taken. enough, so the capture never depends on tap timing; that is how `04-options.png` was taken.
## App pricing
**Decision: a one-time paid app — a free download is off the table.** Foto Dup Finder is sold on
Google Play at a single price: no free tier, no trial, no subscription, no in-app purchase. Nothing
in this repository changes because of that decision — it lives in the Play Console, and the app
carries **no Billing code at all** (see [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) step 4).
Why paid rather than free-with-a-Pro-unlock:
- The app is a **single-purpose utility with no running costs** — no servers, no sync, no accounts —
so there is nothing a subscription would fund and nothing to keep charging for.
- Play Billing would merge `com.android.vending.BILLING` into the manifest and put a purchase screen
into an app whose whole pitch is "no account, no tracking, nothing leaves the device". A price on
the listing costs **zero permissions and changes zero Data Safety answers** — a claim no other
monetisation of this app can make.
- There is no ad SDK and there never will be: an ad SDK adds the `INTERNET` permission, and the
merged-manifest and Data Safety claims below would immediately stop being true.
⚠️ **This is the last moment the choice is still reversible.** Play's rule, from *Set up your app's
prices*: *“You can change your app from paid to free. Once your app has been offered for free, the
app can't be changed to paid. If you want to charge for the app, you need to create a new app with a
new package name and set a price.”* Nothing has been uploaded yet (`versionCode` 2 is still the first
release), so a paid app is still possible; after the first upload to any track it is not. Going free
later stays one click.
**Price: one-time, base €2.99 EUR, launched with a 14-day 50% sale at €1.49.** Play derives every
other market from the base price and applies local pricing patterns, so it is one number to maintain
rather than a per-country table.
**Why the base price is not simply the impulse price.** A €1 base was considered and rejected: Play's
sales let a paid app be discounted whenever you like, but **nothing lets you un-discount it**.
Starting at €1 spends the only lever this model has — raising the price afterwards looks like gouging
to the buyers who told people "it's a euro app" — and there is no free tier or in-app purchase to
recover the difference later, because **a paid app's first transaction is its only transaction**. At
€2.99 the launch sale *is* the €1.49 impulse price, and the real price is waiting when it ends.
The arithmetic, at Play's current fee for a paid app's initial purchase (10% + 5% billing fee ≈
**15%** for the first $1M/year of new-install transactions in the EEA):
| Price | You net (≈) | Units needed to match €2.99 |
|---|---|---|
| €2.99 (base) | €2.54 | 1× |
| €1.49 (launch sale) | €1.27 | 2× |
| €1.00 (rejected) | €0.85 | 3× |
Three Console details matter:
- **Leave "Default price includes tax" off unless you mean it.** Off, VAT is added on top: a German
buyer sees **€3.56** for the €2.99 base and **€1.77** during the sale. On, the sticker price is the
gross price and Play takes the tax out of it.
- **A country you do not set a price for is a country where the app is unavailable.** Play also
enforces a per-country price range — see *currencies and price ranges allowed by country*.
- **Strikethrough is not shown everywhere.** In 12 EU member states (Belgium, Croatia, Czech
Republic, Denmark, Estonia, France, Greece, Hungary, Latvia, Netherlands, Poland, Sweden) and the
UK, buyers see the discounted price with no reference to the original. Germany is *not* one of
them, so "was €2.99" is real for a German buyer — which is why the sale is worth running.
### The launch sale, and the rules that shape it
Play's rules for a paid-app sale are tight enough to design around:
- **1–14 days per sale**, and **30 days must pass between the end of one sale and the start of the
next**. The launch offer is therefore one 14-day window, not "half price for the first month" — a
deadline-driven event rather than the normal price.
- **The app must be published before a sale can be created** (*Monetise › Products › App pricing ›
Sales › Create sale*), so the order is publish first, then schedule the sale; the start date can be
as early as the next day.
- The discount is a **fixed price or a percentage of 10–100%**, the discount must be **at least 10%**,
and the sale price must stay inside the accepted price range. A **100% ($0) sale** exists if the app
should be briefly free instead.
- The sale name lives only in the Play Console; buyers never see it.
**The real cost of this route: no free trial.** A paid app cannot be installed before it is bought,
so the listing has to do all the convincing. The two instruments that do *not* require going free are
the sale above and **promo codes** — a giveaway copy for named testers and reviewers, available at any
time. Use a promo code, never a real purchase, for your own end-to-end buying test:
[PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) step 4.
## Store listing copy ## Store listing copy
### App name (max 30 characters) ### App name (max 30 characters)
@@ -156,19 +374,26 @@ enough, so the capture never depends on tap timing; that is how `04-options.png`
### Short description (max 80 characters) ### Short description (max 80 characters)
Find and remove duplicate photos. Free, ad-free, works offline. Find and remove duplicate photos. Ad-free, works offline, no uploads.
Alternative, if the no-upload promise should lead: Alternative, if the no-account promise should lead:
Find and delete duplicate photos. No ads, no uploads, no account. Find and delete duplicate photos. No ads, no uploads, no account.
Neither option may say "free": the app is paid, so the claim would simply be false. Play's metadata
policy also bans price and promotional wording in the **app title, icon and developer name**
("free for limited time only" is its own example), which is why the price story below lives in the
description body and is written as a plain statement of fact — no discounts, no urgency, nothing
that reads as a promotion.
### Full description (max 4000 characters) ### Full description (max 4000 characters)
Find and remove duplicate photos, then get the space back. Foto Dup Finder does one Find and remove duplicate photos, then get the space back. Foto Dup Finder does one
job and does it without ads, without an account and without ever uploading anything. job and does it without ads, without an account and without ever uploading anything.
WHY IT IS DIFFERENT WHY IT IS DIFFERENT
• No ads — no banners, no interstitials, no upsells. • Pay once, then own it. No ads, no banners, no interstitials, no subscriptions and no
in-app purchases — there is nothing else to buy, now or later.
• No internet permission at all, so the app has no way to upload your photos. • No internet permission at all, so the app has no way to upload your photos.
• No account, no sign-in, no tracking, no analytics. • No account, no sign-in, no tracking, no analytics.
@@ -204,6 +429,8 @@ Alternative, if the no-upload promise should lead:
GOOD TO KNOW GOOD TO KNOW
• Requires Android 8.0 or newer. • Requires Android 8.0 or newer.
• Sold through Google Play as a one-time purchase — no subscription, no in-app
purchases, no account.
• Photos moved to the trash can be restored from your gallery app until the trash is • Photos moved to the trash can be restored from your gallery app until the trash is
emptied (Android 11 and newer). emptied (Android 11 and newer).
• Works fully offline, in flight mode, always. • Works fully offline, in flight mode, always.
@@ -213,6 +440,12 @@ merged manifest, no ad or analytics dependency in `gradle/libs.versions.toml`, `
in `app/build.gradle.kts`, and the second-run speed-up is the persistent hash index in in `app/build.gradle.kts`, and the second-run speed-up is the persistent hash index in
`data/PhotoIndexStore.kt`. `data/PhotoIndexStore.kt`.
The price is the one claim that is *not* in here, because it is a Play Console setting
(`Products > App pricing`) rather than code. What *is* checkable is the rest of the monetisation
story — the absence of it: no Billing dependency in `gradle/libs.versions.toml`, and no
`com.android.vending.BILLING` in the merged manifest (see
[PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) step 5).
### Category and tags ### Category and tags
- **Category:** Tools (alternative: Photography — *Tools* matches the one-job utility framing - **Category:** Tools (alternative: Photography — *Tools* matches the one-job utility framing
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 KiB

+3 -1
View File
@@ -38,4 +38,6 @@ render() { # <svg> <width> <height> <filename> <keep-alpha|flatten>
echo "Writing store assets to $out" echo "Writing store assets to $out"
render "$here/store-assets/icon.svg" 512 512 icon-512.png keep-alpha render "$here/store-assets/icon.svg" 512 512 icon-512.png keep-alpha
render "$here/store-assets/feature-graphic.svg" 1024 500 feature-graphic-1024x500.png flatten render "$here/store-assets/feature-graphic.svg" 1024 500 feature-graphic-1024x500.png flatten
echo "Done. Screenshots: ./tools/make-store-screenshots.sh # reads store-assets/raw-screenshots/" echo "Done. Screenshots: ./tools/make-store-screenshots.sh # reads store-assets/raw-screenshots/phone/"
echo " Tablets: FORM_FACTOR=tablet-7in ./tools/make-store-screenshots.sh"
echo " FORM_FACTOR=tablet-10in ./tools/make-store-screenshots.sh"
+78 -20
View File
@@ -1,54 +1,94 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Turns raw device screenshots into Play-legal store screenshots. # Turns raw device screenshots into Play-legal store screenshots, one directory per form
# factor, because Play gives phones and each tablet size their own slot.
# #
# ./tools/make-store-screenshots.sh [raw-dir] [output-dir] # ./tools/make-store-screenshots.sh [raw-dir] [output-dir]
# #
# Both paths default to inside the repo, never to $HOME: # FORM_FACTOR selects the Play Console slot the captures belong to
# raw store-assets/raw-screenshots/ git-ignored staging for the `adb` captures # (Main store listing > Graphics > Phone / 7-inch tablet / 10-inch tablet):
# output store-assets/screenshots/ the cropped files that get uploaded to Play
# #
# Why this exists: Play rejects a screenshot whose longer side is more than twice its # FORM_FACTOR=phone (default) store-assets/raw-screenshots/phone/ -> store-assets/screenshots/phone/
# shorter side ("your screenshot's maximum dimension can't be more than twice its minimum # FORM_FACTOR=tablet-7in store-assets/raw-screenshots/tablet-7in/ -> store-assets/screenshots/tablet-7in/
# dimension"). A 1080 x 2400 phone capture is 2.22:1, so it has to become 1080 x 2160. # FORM_FACTOR=tablet-10in store-assets/raw-screenshots/tablet-10in/ -> store-assets/screenshots/tablet-10in/
# #
# The crop removes system chrome only — the status bar at the top, the navigation bar at the # Both paths are inside the repo, never in $HOME. Pass raw-dir / output-dir positionally to
# bottom — never app content. Both heights were measured on the test device: # override them (that is what the tests and one-off captures use).
#
# Why this exists: Play rejects a screenshot whose longer side is more than twice its shorter
# side ("The maximum dimension of your screenshot can't be more than twice as long as the
# minimum dimension"), and requires 24-bit PNG or JPEG without alpha, a shorter side of at
# least 320 px and a longer side of at most 3840 px.
#
# Phone A 1080 x 2400 capture is 2.22:1 and has to lose system chrome to reach the 2:1
# cap. Both bar heights were measured on the test device:
# #
# STATUS_BAR_PX ITYPE_STATUS_BAR frame height 93 px (1080 x 2400 @ 440 dpi) # STATUS_BAR_PX ITYPE_STATUS_BAR frame height 93 px (1080 x 2400 @ 440 dpi)
# NAV_BAR_PX ITYPE_NAVIGATION_BAR bottom inset 130 px (same device) # NAV_BAR_PX ITYPE_NAVIGATION_BAR bottom inset 130 px (same device)
# #
# Tablet No tablet screen Android ships is anywhere near 2:1 — the 7" WSVGA profile is
# 1024 x 600 (1.71:1) and the 10-inch profiles (10.1" WXGA, Nexus 10, Medium
# Tablet, Pixel Tablet) are 1280 x 800 or 2560 x 1600 (1.60:1) — so a tablet frame
# is already legal and crops 0 px by default. Cropping chrome there is cosmetic
# only, so it is opt-in: measure on your device and pass the insets.
#
# Measure either device with (the bar heights are device- and OEM-specific, and MIUI is not
# AOSP: the AOSP defaults would have been 24 dp and 48 dp):
#
# adb shell dumpsys window displays | grep -oE 'ITYPE_STATUS_BAR frame=\[[^]]*\]\[[^]]*\]' # adb shell dumpsys window displays | grep -oE 'ITYPE_STATUS_BAR frame=\[[^]]*\]\[[^]]*\]'
# adb shell dumpsys window displays | grep -oE 'control type=ITYPE_NAVIGATION_BAR.*mInsetsHint=\{[^}]*\}' # adb shell dumpsys window displays | grep -oE 'control type=ITYPE_NAVIGATION_BAR.*mInsetsHint=\{[^}]*\}'
# #
# Output is 24-bit PNG without alpha, which is what Play asks for. Captures are not shot by # The crop removes system chrome only, never app content. Output is 24-bit PNG without alpha,
# this script — take them yourself (the shot list is in docs/STORE_LISTING.md) and drop them # which is what Play asks for. Captures are not shot by this script — take them yourself (the
# into store-assets/raw-screenshots/, or pass the directory as the first argument. # shot list is in docs/STORE_LISTING.md) and drop them into the raw directory, or pass that
# directory as the first argument.
set -euo pipefail set -euo pipefail
here="$(cd "$(dirname "$0")" && pwd)" here="$(cd "$(dirname "$0")" && pwd)"
repo="$(dirname "$here")" repo="$(dirname "$here")"
raw="${1:-$repo/store-assets/raw-screenshots}"
out="${2:-$repo/store-assets/screenshots}" form_factor="${FORM_FACTOR:-phone}"
status_bar="${STATUS_BAR_PX:-93}" case "$form_factor" in
nav_bar="${NAV_BAR_PX:-130}" phone) default_status_bar=93; default_nav_bar=130 ;;
tablet-7in) default_status_bar=0; default_nav_bar=0 ;;
tablet-10in) default_status_bar=0; default_nav_bar=0 ;;
*)
echo "usage: FORM_FACTOR=<phone|tablet-7in|tablet-10in> $0 [raw-dir] [output-dir]" >&2
echo "error: unknown FORM_FACTOR '$form_factor'" >&2
exit 2
;;
esac
raw="${1:-$repo/store-assets/raw-screenshots/$form_factor}"
out="${2:-$repo/store-assets/screenshots/$form_factor}"
status_bar="${STATUS_BAR_PX:-$default_status_bar}"
nav_bar="${NAV_BAR_PX:-$default_nav_bar}"
if [ ! -d "$raw" ]; then if [ ! -d "$raw" ]; then
echo "usage: $0 [raw-screenshot-dir] [output-dir]" >&2 echo "usage: FORM_FACTOR=<phone|tablet-7in|tablet-10in> $0 [raw-screenshot-dir] [output-dir]" >&2
echo "error: no such directory: $raw" >&2 echo "error: no such directory: $raw" >&2
echo " capture first, e.g. adb exec-out screencap -p > $raw/01-empty.png" >&2 echo " capture first, e.g. adb exec-out screencap -p > $raw/01-empty.png" >&2
exit 2 exit 2
fi fi
mkdir -p "$out" mkdir -p "$out"
echo "$form_factor: $raw -> $out (crop ${status_bar} px status bar + ${nav_bar} px navigation bar, clamp to 2:1)"
shopt -s nullglob shopt -s nullglob
for f in "$raw"/*.png; do shots=("$raw"/*.png)
if [ ${#shots[@]} -eq 0 ]; then
echo "error: no .png captures in $raw" >&2
echo " capture first, e.g. adb exec-out screencap -p > $raw/01-empty.png" >&2
exit 2
fi
for f in "${shots[@]}"; do
name="$(basename "$f")" name="$(basename "$f")"
width="$(identify -format '%w' "$f")" width="$(identify -format '%w' "$f")"
height="$(identify -format '%h' "$f")" height="$(identify -format '%h' "$f")"
# Drop the two system bars, then clamp to a 2:1 portrait frame. # Drop the two system bars (0 px for tablets, where the frame is already legal), then
# clamp to a 2:1 portrait frame.
keep=$(( height - status_bar - nav_bar )) keep=$(( height - status_bar - nav_bar ))
cap=$(( width * 2 )) cap=$(( width * 2 ))
if [ "$keep" -gt "$cap" ]; then if [ "$keep" -gt "$cap" ]; then
@@ -57,6 +97,24 @@ for f in "$raw"/*.png; do
magick "$f" -crop "${width}x${keep}+0+${status_bar}" +repage \ magick "$f" -crop "${width}x${keep}+0+${status_bar}" +repage \
-background '#FFFBFE' -alpha remove -alpha off PNG24:"$out/$name" -background '#FFFBFE' -alpha remove -alpha off PNG24:"$out/$name"
# Play's limits, checked on the file that actually gets uploaded rather than on the maths.
out_width="$(identify -format '%w' "$out/$name")"
out_height="$(identify -format '%h' "$out/$name")"
if [ "$out_width" -lt "$out_height" ]; then
short="$out_width"; long="$out_height"
else
short="$out_height"; long="$out_width"
fi
warn=''
if [ "$short" -lt 320 ]; then
warn="$warn ⚠️ shorter side under Play's 320 px minimum"
fi
if [ "$long" -gt 3840 ]; then
warn="$warn ⚠️ longer side over Play's 3840 px maximum"
fi
printf ' %s %s -> ' "$name" "$(identify -format '%wx%h' "$f")" printf ' %s %s -> ' "$name" "$(identify -format '%wx%h' "$f")"
identify -format '%wx%h %[channels] %b\n' "$out/$name" identify -format '%wx%h %[channels] %b' "$out/$name"
printf '%s\n' "$warn"
done done
+372
View File
@@ -0,0 +1,372 @@
#!/usr/bin/env bash
#
# Records the demonstration video that Google Play's foreground-service declaration asks for.
#
# ./tools/record-fgs-demo.sh [serial] [output-dir] # default: first adb device, ./store-assets/fgs-demo
#
# Play requires, per declared foreground-service type, "a link to a video demonstrating each
# foreground service feature. The video should demonstrate the steps the user needs to take in
# your app in order to trigger the feature." So this records an end-to-end *user journey*, not a
# screen of a progress bar:
#
# app open on the empty state -> user taps Start scan -> user presses Home -> the ongoing
# notification is visible in the shade while the scan keeps running -> back into the app for
# the finished results
#
# A foreground service only exists while work is running, so this needs a real device or an
# emulator and something to scan. `tools/make-demo-photos.py` supplies the library, so no real
# photo is ever in the frame, and the library is deleted from the device again afterwards.
#
# Two failure modes this script works around, both learned the hard way on a software-emulated AVD
# (no /dev/kvm, so everything below is slower than it looks):
#
# 1. `input tap` can land before the app is interactive and do nothing at all. Every tap is
# therefore preceded by a `uiautomator dump` for the *live* coordinates and followed by a
# check that the expected next screen appeared, with one retry.
# 2. A finished scan leaves the app on its results screen, where "Start scan" no longer exists -
# tapping those old coordinates silently does nothing. The recording therefore always starts
# from `am force-stop` + `am start`, i.e. the documented empty state.
#
# It also writes a checkpoint PNG at each milestone, so the recording can be checked without
# decoding the video. `ffprobe` is used for the duration when it is installed.
#
# On a host with no KVM the one lever that ever got the service started here was QEMU's clock
# dilation, which makes Android's deadline be measured in slower time than the host's:
#
# emulator -avd <name> ... -qemu -icount shift=1,sleep=off # guest clock ran 2.30x slow
#
# That worked once and then not again, so treat it as a lead rather than a recipe: scale the two
# timing knobs up for a dilated clock (the guest is slower at everything, dumps included) and expect
# to iterate. docs/PLAY_RELEASE_CHECKLIST.md step 5 has the long version of this note.
set -euo pipefail
here="$(cd "$(dirname "$0")" && pwd)"
repo="$(dirname "$here")"
pkg="de.softwareapp_hb.fotodup.finder.debug"
activity="$pkg/de.softwareapp_hb.fotodup.finder.MainActivity"
apk="${APK:-$repo/app/build/outputs/apk/debug/app-debug.apk}"
serial="${1:-$(adb devices | awk 'NR==2 {print $1}')}"
out="${2:-$repo/store-assets/fgs-demo}"
remote=/data/local/tmp/fgs-demo.mp4
recording_seconds="${RECORDING_SECONDS:-150}"
if [ -z "$serial" ]; then
echo "usage: $0 [serial] [output-dir]" >&2
echo "error: no adb device or emulator attached" >&2
exit 2
fi
adb=(adb -s "$serial")
mkdir -p "$out"
say() { printf '\n== %s\n' "$*"; }
# --------------------------------------------------------------------- UI helpers
# bounds_to_centre <bounds attribute value> -> "x y"
bounds_to_centre() {
local x1 y1 x2 y2
# bounds is "[x1,y1][x2,y2]". Stripping everything but digits and commas is not enough: the
# "][ " between the two corners disappears too, which glued y1 to x2 and produced coordinates
# like "976 723061" - a tap that lands nowhere, with no error to show for it.
read -r x1 y1 x2 y2 <<< "$(printf '%s' "$1" \
| sed -E 's/.*\[([0-9]+),([0-9]+)\]\[([0-9]+),([0-9]+)\].*/\1 \2 \3 \4/')"
echo "$(( (x1 + x2) / 2 )) $(( (y1 + y2) / 2 ))"
}
node_by_pattern() {
local bounds
bounds="$(ui_dump | tr '>' '\n' | grep -i -m1 "$1" \
| grep -o 'bounds="\[[0-9]*,[0-9]*\]\[[0-9]*,[0-9]*\]"' | head -1 || true)"
[ -n "$bounds" ] || return 1
bounds_to_centre "$bounds"
}
# node_centre <text> -> "x y" for the first node whose text contains it. Substring match on purpose:
# the screens label themselves ("Start scan", "Cancel"), but the results card says "2 duplicate
# groups", which an exact match would never find. Anchors must not be passed in here - "^Cancel$"
# would be compared literally against the attribute text.
node_centre() { node_by_pattern "text=\"[^\"]*$1[^\"]*\""; }
# node_centre_exact <text> -> the same, but only for a node whose text *is* this. Needed for the
# top bar's "Scan", which must not match the intro's "Start scan".
node_centre_exact() { node_by_pattern "text=\"$1\""; }
ui_dump() {
"${adb[@]}" shell 'uiautomator dump /data/local/tmp/ui.xml >/dev/null 2>&1; cat /data/local/tmp/ui.xml'
}
# wait_for <text> <seconds> -> "x y" once a node whose text contains it appears.
wait_for() {
local deadline=$(( SECONDS + $2 )) coords
while [ "$SECONDS" -lt "$deadline" ]; do
if coords="$(node_centre "$1")"; then
echo "$coords"
return 0
fi
sleep 3
done
return 1
}
# wait_for_exact <text> <seconds> -> the same for an exact text match.
wait_for_exact() {
local deadline=$(( SECONDS + $2 )) coords
while [ "$SECONDS" -lt "$deadline" ]; do
if coords="$(node_centre_exact "$1")"; then
echo "$coords"
return 0
fi
sleep 3
done
return 1
}
notifications_from_app() {
"${adb[@]}" shell dumpsys notification --noredact 2>/dev/null \
| grep -c 'NotificationRecord(.*fotodup' || true
}
# The signal that actually matters. A service *record* appears as soon as startForegroundService() is
# called, so it does not prove that startForeground() succeeded - and that five-second gap is exactly
# what kills this app on a slow emulator. The first version of this script used the record as its
# "scan started" evidence and therefore reported success on runs where the app was being killed
# (logcat's events buffer shows am_crash ForegroundServiceDidNotStartInTimeException moments later).
# The app's notification only exists once startForeground() has been called, so wait for that.
fgs_started() { [ "$(notifications_from_app)" != "0" ]; }
# Secondary signal, for logging only.
scan_running() { "${adb[@]}" shell dumpsys activity services 2>/dev/null | grep -q -i ScanService; }
checkpoint() { # <label> — one PNG per milestone, so the video can be verified without decoding it
"${adb[@]}" exec-out screencap -p > "$out/checkpoint-$1.png" 2>/dev/null || true
printf ' checkpoint-%s.png %s\n' "$1" "$(identify -format '%wx%h' "$out/checkpoint-$1.png" 2>/dev/null || echo '?')"
}
# --------------------------------------------------------------- device and app setup
say "Device $serial"
if [ "${INSTALL:-1}" = "1" ]; then
"${adb[@]}" install -r "$apk" | tail -1
else
# MIUI refuses shell-initiated installs unless "Install via USB" is on, and answers one of them
# with two dialogs (Play Protect, then its own installer) that a script cannot see. So the APK
# comes from the device itself: INSTALL=0 records with whatever build is already installed.
printf ' install skipped (INSTALL=0); recording with the build already on the device\n'
fi
# The video is about the foreground service, not about a permission prompt, so grant photo access
# up front - the "Photo access needed" banner would otherwise be the first thing a reviewer sees.
"${adb[@]}" shell pm grant "$pkg" android.permission.READ_EXTERNAL_STORAGE 2>/dev/null || true
say "Demo library"
python3 "$here/make-demo-photos.py" >/dev/null
# Wipe and re-index before pushing. Pushing over a folder MediaStore has already indexed can leave
# a second row per file, and the video would then show a library made entirely of exact duplicates.
"${adb[@]}" shell rm -rf /sdcard/DCIM/foto-dup-demo
"${adb[@]}" shell content call --uri content://media --method scan_file --arg /sdcard/DCIM/foto-dup-demo >/dev/null 2>&1 || true
sleep 2
"${adb[@]}" push "$repo/demo-photos/foto-dup-demo" /sdcard/DCIM/foto-dup-demo 2>&1 | tail -1
"${adb[@]}" shell content call --uri content://media --method scan_file --arg /sdcard/DCIM/foto-dup-demo >/dev/null
sleep 2
local_files="$(find "$repo/demo-photos/foto-dup-demo" -name '*.jpg' | wc -l)"
# Count the demo folder only, not the whole library: on a real phone the rest of the library is the
# owner's own photos and is meant to be there. What matters is that the demo group out-ranks it,
# which is what tools/make-demo-photos.py's --target-mb is for.
indexed="$("${adb[@]}" shell content query --uri content://media/external/images/media --projection relative_path 2>/dev/null \
| grep -c 'foto-dup-demo' || true)"
indexed="${indexed:-0}"
printf ' %s demo photos indexed, %s in the generated library\n' "$indexed" "$local_files"
if [ "$indexed" -lt "$local_files" ]; then
echo "warn: fewer demo photos are indexed than were generated - the results capture may not show the demo group first" >&2
fi
say "Clearing stale notifications, so the shade shows only this app"
"${adb[@]}" shell cmd statusbar expand-notifications >/dev/null 2>&1 || true
sleep 3
if clear_all="$(node_centre 'Clear all')"; then
"${adb[@]}" shell input tap $clear_all
printf ' tapped Clear all at %s\n' "$clear_all"
fi
"${adb[@]}" shell cmd statusbar collapse >/dev/null 2>&1 || true
sleep 2
# --------------------------------------------------------------------- warm-up
#
# The one thing that reliably kills this capture on a software-emulated device (no /dev/kvm) is the
# platform's five-second startForegroundService() deadline: the app is killed with
# ForegroundServiceDidNotStartInTimeException and the activity is force-finished, so the launcher
# appears where the scan should have started. logcat's events buffer names it:
#
# am_crash: [..., android.app.ForegroundServiceDidNotStartInTimeException,
# Context.startForegroundService() did not then call Service.startForeground(): ...]
# am_proc_died: [...]
#
# It is a question of CPU, not of the app: the same build starts the service immediately when the
# process has been alive for a while (classes loaded, JIT warm) and the emulator is not still doing
# first-boot work. So warm the app up first, and only start recording once a real scan has been
# confirmed - by the notification, for the reason given at fgs_started().
warm_up() {
if [ "${SETTLE_SECONDS:-150}" != "0" ]; then
say "Letting the emulator settle (first-boot work competes for the same CPU)"
sleep "${SETTLE_SECONDS:-150}"
fi
say "Warming the app up (a cold process misses the FGS deadline - see the note in this script)"
attempt=0
while [ "$attempt" -lt 4 ]; do
attempt=$(( attempt + 1 ))
"${adb[@]}" shell am force-stop "$pkg"
"${adb[@]}" shell am start -n "$activity" >/dev/null
# Time for the process to load its classes before it is asked to start a service in under five
# seconds. This is the difference between the runs that worked and the ones that crashed.
sleep "${WARM_SECONDS:-75}"
if ! start="$(wait_for 'Start scan' 120)"; then
echo "error: the empty state never appeared - right APK installed? photo access granted?" >&2
exit 3
fi
"${adb[@]}" shell input tap $start
started=no
# dumpsys only while the service starts: every `uiautomator dump` spawns a JVM on the device and
# competes for exactly the CPU that the five-second deadline is measured against.
for tap_try in 1 2 3; do
for _ in $(seq 1 12); do
if fgs_started; then started=yes; break; fi
sleep 3
done
if [ "$started" = yes ]; then break; fi
printf ' tap %s did not start the service' "$tap_try"
# On a slowed emulator the window can still be settling even though the accessibility tree
# already lists the button, so the tap goes nowhere. Tapping again is far cheaper than the
# cold restart the outer loop would otherwise resort to.
if start="$(wait_for 'Start scan' 60)"; then
printf ' - tapping again\n'
"${adb[@]}" shell input tap $start
else
printf ' - the intro is gone, so restarting instead\n'
break
fi
done
if [ "$started" = yes ]; then
printf ' attempt %s: the service started (notification posted)\n' "$attempt"
break
fi
printf ' attempt %s: the service never started\n' "$attempt"
"${adb[@]}" logcat -b events -d -t 400 2>/dev/null | grep -m1 'am_crash' || true
done
if [ "$started" != yes ]; then
echo "error: no scan could be started on this emulator - record the video on a real device" >&2
exit 4
fi
}
# A real device needs none of that warm-up, and skipping it is what keeps the *cold* first scan -
# ~20 s over 5,385 photos - as the one on camera. That is not a nicety: a warm scan on this phone
# finishes in about five seconds, which is less than the notification shade takes to render, so the
# take would film an empty shade. Hence WARMUP=0 for a real device, and the trigger becomes the
# intro's own button rather than the results screen's "Scan".
trigger_text='Scan'
trigger_exact=1
# Pacing: the emulator needs a long, dump-free window after the tap because the FGS deadline is the
# thing at risk there. A real device does not - the notification is up within a second - and it needs
# the opposite, because its cold scan is only ~20 s and the shade has to be open *while it runs*.
post_tap_wait=8
leave_wait=3
shade_wait=6
if [ "${WARMUP:-1}" = "0" ]; then
say "Warm-up skipped (WARMUP=0): the cold first scan is the one being recorded"
post_tap_wait=2
leave_wait=1
shade_wait=5
"${adb[@]}" shell am force-stop "$pkg"
"${adb[@]}" shell am start -n "$activity" >/dev/null
if ! wait_for 'Start scan' 120 >/dev/null; then
echo "error: the empty state never appeared - right APK installed? photo access granted?" >&2
exit 3
fi
trigger_text='Start scan'
trigger_exact=0
else
warm_up
fi
if [ "${WARMUP:-1}" != "0" ]; then
# Let the warm-up scan run to *completion* instead of cancelling it: cancelling does not lead
# back to the intro, and restarting the app to get there throws away exactly the warmth that
# keeps the deadline met - which is how the first recordings ended up with the platform killing
# the app on camera. So the recorded scan is triggered the way a returning user triggers one:
# the top bar's "Scan", on the results screen.
say "Letting the warm-up scan finish"
if ! wait_for 'duplicate group' 300 >/dev/null; then
wait_for 'No duplicates found' 20 >/dev/null \
|| echo "warn: the warm-up scan never reached a result screen" >&2
fi
checkpoint 0-warmup-results
fi
say "Recording (screenrecord, at most ${recording_seconds}s)"
"${adb[@]}" shell rm -f "$remote"
# 540x1200 at 2M, not 720x1600 at 8M: the encoder runs on the guest CPU as well, and an expensive
# recording is precisely what pushes the app past the five-second deadline.
"${adb[@]}" shell screenrecord --size 540x1200 --bit-rate 2M --time-limit "$recording_seconds" "$remote" &
recorder_pid=$!
sleep 3
# The trigger. This is the step the declaration video exists to show.
if [ "$trigger_exact" = 1 ]; then
# Exact match, because the results card's "Scanned in 5.4 s" also contains "Scan".
scan_button="$(wait_for_exact "$trigger_text" 30)" || true
else
scan_button="$(wait_for "$trigger_text" 30)" || true
fi
if [ -z "$scan_button" ]; then
echo "error: no '$trigger_text' button on screen to trigger the scan with" >&2
exit 3
fi
printf ' %s at %s\n' "$trigger_text" "$scan_button"
"${adb[@]}" shell input tap $scan_button
sleep "$post_tap_wait" # deliberately dump-free: this is the deadline window
if ! fgs_started; then
printf ' the service did not start; the events buffer said:\n'
"${adb[@]}" logcat -b events -d -t 400 2>/dev/null | grep -m1 'am_crash' || true
echo "warn: no scan running - the video will not show the service" >&2
else
checkpoint 1-scanning
printf ' the service started (notification posted)\n'
fi
# Away from the app: from here on the service is what keeps the scan alive.
sleep "$leave_wait"
"${adb[@]}" shell input keyevent KEYCODE_HOME
sleep 2
"${adb[@]}" shell cmd statusbar expand-notifications
sleep "$shade_wait"
checkpoint 2-notification
printf ' notifications posted by the app: %s\n' "$(notifications_from_app)"
# Back into the app for the payoff, waiting for the scan to have produced a result.
"${adb[@]}" shell cmd statusbar collapse
"${adb[@]}" shell am start -n "$activity" >/dev/null
if wait_for 'duplicate group' 240 >/dev/null || wait_for 'No duplicates found' 10 >/dev/null; then
sleep 3
checkpoint 3-results
fi
say "Finalising the recording"
# SIGINT-ing the *device* process is what writes the moov atom; killing the local adb client would
# leave screenrecord orphaned on the device and the pulled file unplayable.
"${adb[@]}" shell 'pidof screenrecord | xargs -r kill -2' || true
wait "$recorder_pid" 2>/dev/null || true
sleep 2
"${adb[@]}" pull "$remote" "$out/foreground-service-demo.mp4" 2>&1 | tail -1
"${adb[@]}" shell rm -f "$remote"
say "Taking the demo library back off the device"
"${adb[@]}" shell rm -rf /sdcard/DCIM/foto-dup-demo
"${adb[@]}" shell content call --uri content://media --method scan_file --arg /sdcard/DCIM/foto-dup-demo >/dev/null || true
say "Done"
if command -v ffprobe >/dev/null; then
ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 \
"$out/foreground-service-demo.mp4" | awk '{printf " recorded %.1f s\n", $1}' || true
fi
echo ' Upload it (an unlisted YouTube link works) and paste the link into the declaration form.'