Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9fb5e7de3d | |||
| 52cf2fc85a | |||
| ddc7fb44b0 | |||
| 179bc2cc33 | |||
| ae05a0dad4 | |||
| ea894841a2 | |||
| 1ce2f2e1f4 | |||
| f45e3b79ab | |||
| 5cb7ad66a8 |
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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,9 +177,18 @@ 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.
|
||||||
|
|
||||||
|
|||||||
@@ -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/` (git-ignored): 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/`
|
||||||
|
(git-ignored) 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
|
||||||
@@ -181,13 +234,94 @@ 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**:
|
||||||
|
|
||||||
> The app finds duplicate photos on the device. The user starts a scan and may leave
|
1. **Description** of the app functionality using the type:
|
||||||
> 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
|
> The app finds duplicate photos on the device. The user starts a scan and may leave
|
||||||
> index of file hashes. It performs no network access and transfers no data.
|
> 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
|
||||||
|
> 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` (git-ignored, like the
|
||||||
|
screenshots) with a checkpoint PNG per milestone beside it. 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. Host the file where a reviewer can open it without
|
||||||
|
signing in — an unlisted YouTube link is the usual choice — and paste that link into the
|
||||||
|
declaration. Replacing the video later means resubmitting it.
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -282,13 +416,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.
|
||||||
|
|||||||
@@ -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); screenshots are deliberately not committed |
|
||||||
|
|
||||||
## 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. Only hosting it (an unlisted YouTube link) and pasting that link remain. 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 / 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.
|
||||||
|
|||||||
@@ -12,23 +12,36 @@ release.
|
|||||||
Generated into `store-assets/` **inside the repository**, never into `$HOME`. The icon and the
|
Generated into `store-assets/` **inside the repository**, never into `$HOME`. The icon and the
|
||||||
feature graphic are the files that get uploaded to the Play Console, so they are committed and
|
feature graphic are the files that get uploaded to the Play Console, so they are committed and
|
||||||
versioned with the release they belong to. **Screenshots are not committed** — neither the raw
|
versioned with the release they belong to. **Screenshots are not committed** — neither the raw
|
||||||
captures (`store-assets/raw-screenshots/`) nor the cropped ones (`store-assets/screenshots/`) —
|
captures (`store-assets/raw-screenshots/`) nor the normalised ones (`store-assets/screenshots/`) —
|
||||||
because a screenshot of this app is a picture of a photo library. Regenerate them with the
|
because a screenshot of this app is a picture of a photo library. Regenerate them with the
|
||||||
commands below and upload them straight from disk.
|
commands below and upload them 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
|
||||||
|
```
|
||||||
|
|
||||||
```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/
|
||||||
python3 tools/make-demo-photos.py # synthetic photo library -> demo-photos/ (git-ignored)
|
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)
|
||||||
```
|
```
|
||||||
|
|
||||||
| 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 +50,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 +95,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
|
||||||
@@ -148,6 +266,84 @@ Captures are taken by hand, because each of these screens needs a tap and MIUI o
|
|||||||
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 +352,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 +407,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 +418,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
|
||||||
|
|||||||
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 484 KiB |
|
After Width: | Height: | Size: 499 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 736 KiB |
|
After Width: | Height: | Size: 756 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 557 KiB |
|
After Width: | Height: | Size: 576 KiB |
@@ -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"
|
||||||
|
|||||||
@@ -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).
|
||||||
#
|
#
|
||||||
# STATUS_BAR_PX ITYPE_STATUS_BAR frame height 93 px (1080 x 2400 @ 440 dpi)
|
# Why this exists: Play rejects a screenshot whose longer side is more than twice its shorter
|
||||||
# NAV_BAR_PX ITYPE_NAVIGATION_BAR bottom inset 130 px (same device)
|
# 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)
|
||||||
|
# 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
|
||||||
|
|||||||
@@ -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.'
|
||||||
|
|
||||||