Compare commits
7 Commits
9c17d65088
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 2081cd1747 | |||
| c634a247a3 | |||
| 6d031082a3 | |||
| 4739069737 | |||
| 6ff916ba57 | |||
| 819fc9b905 | |||
| 0803d0f5ad |
@@ -12,7 +12,7 @@ definition of done for this repository.
|
|||||||
|---|---|
|
|---|---|
|
||||||
| Product | Foto Dup Finder — offline duplicate/near-duplicate photo finder |
|
| Product | Foto Dup Finder — offline duplicate/near-duplicate photo finder |
|
||||||
| Model | **Freemium**: free tier with one AdMob banner, one-time Pro purchase removes ads |
|
| Model | **Freemium**: free tier with one AdMob banner, one-time Pro purchase removes ads |
|
||||||
| Current version | `1.1.0` / `versionCode 4` (`app/build.gradle.kts`) |
|
| Current version | `1.1.2` / `versionCode 7` (`app/build.gradle.kts`) |
|
||||||
| Platform | Android, Kotlin + Jetpack Compose, single `:app` module |
|
| Platform | Android, Kotlin + Jetpack Compose, single `:app` module |
|
||||||
| Application id | `de.softwareapp_hb.fotodup.finder.free` (debug `.free.debug`); namespace/code package remains `de.softwareapp_hb.fotodup.finder` |
|
| Application id | `de.softwareapp_hb.fotodup.finder.free` (debug `.free.debug`); namespace/code package remains `de.softwareapp_hb.fotodup.finder` |
|
||||||
| SDKs | `minSdk 26`, `compileSdk`/`targetSdk` 36 |
|
| SDKs | `minSdk 26`, `compileSdk`/`targetSdk` 36 |
|
||||||
@@ -30,7 +30,8 @@ Roadmap: [`docs/ROADMAP.md`](docs/ROADMAP.md)
|
|||||||
Release checklist: [`docs/PLAY_RELEASE_CHECKLIST.md`](docs/PLAY_RELEASE_CHECKLIST.md)
|
Release checklist: [`docs/PLAY_RELEASE_CHECKLIST.md`](docs/PLAY_RELEASE_CHECKLIST.md)
|
||||||
Privacy policy: [`PRIVACY.md`](PRIVACY.md)
|
Privacy policy: [`PRIVACY.md`](PRIVACY.md)
|
||||||
|
|
||||||
**Current gate:** the freemium release (`1.1.0`) is implemented in code, but the
|
**Current gate:** the freemium release (`1.1.2`, the foreground-service bugfix on top of
|
||||||
|
the `1.1.1` freemium build) is implemented in code, but the
|
||||||
Play Console work (change the app to free, create `pro_no_ads`, AdMob app/unit,
|
Play Console work (change the app to free, create `pro_no_ads`, AdMob app/unit,
|
||||||
UMP message, Data Safety, Ads/Advertising ID declarations) is manual. Do not
|
UMP message, Data Safety, Ads/Advertising ID declarations) is manual. Do not
|
||||||
describe the app as "ad-free", "no internet" or "paid once" — those claims belong
|
describe the app as "ad-free", "no internet" or "paid once" — those claims belong
|
||||||
@@ -166,7 +167,9 @@ Never use `./gradlew --offline` for a fresh dependency check, and never commit
|
|||||||
stuck provider must produce an unreadable photo, not a frozen scan.
|
stuck provider must produce an unreadable photo, not a frozen scan.
|
||||||
5. **The scan is process-scoped.** `ScanController` owns the job and result; the
|
5. **The scan is process-scoped.** `ScanController` owns the job and result; the
|
||||||
ViewModel mirrors `ScanState`. `ScanService` keeps a `dataSync` foreground
|
ViewModel mirrors `ScanState`. `ScanService` keeps a `dataSync` foreground
|
||||||
service alive while it runs.
|
service alive while it runs. It calls `startForeground()` in `onCreate()` and at
|
||||||
|
the top of every `onStartCommand()`, and **nothing outside it calls
|
||||||
|
`stopService()`** — the service stops itself when it sees `scanning == false`.
|
||||||
6. **Thresholds are fitted, then clamped.** `DuplicatePolicy` supplies ceilings;
|
6. **Thresholds are fitted, then clamped.** `DuplicatePolicy` supplies ceilings;
|
||||||
`AdaptiveThreshold` fits the pHash cut to the candidate population; exact
|
`AdaptiveThreshold` fits the pHash cut to the candidate population; exact
|
||||||
grouping does not decode anything.
|
grouping does not decode anything.
|
||||||
@@ -242,6 +245,13 @@ Never use `./gradlew --offline` for a fresh dependency check, and never commit
|
|||||||
- Minimum before calling a change done:
|
- Minimum before calling a change done:
|
||||||
`./gradlew :app:testDebugUnitTest :app:lintDebug :app:assembleDebug`.
|
`./gradlew :app:testDebugUnitTest :app:lintDebug :app:assembleDebug`.
|
||||||
For release changes also `:app:assembleRelease` (R8 + manifest merge).
|
For release changes also `:app:assembleRelease` (R8 + manifest merge).
|
||||||
|
- **Launch a minified build before uploading.** `assembleDebug` does not run R8 and
|
||||||
|
cannot catch shrinker-only startup crashes. Either install the release APK on a
|
||||||
|
device (uninstall the Play-signed copy first if the signatures conflict) or
|
||||||
|
temporarily enable `isMinifyEnabled`/`isShrinkResources` in the debug build type
|
||||||
|
and install it side by side. The `1.1.0` upload crashed in
|
||||||
|
`androidx.startup.InitializationProvider` because R8 removed WorkManager's
|
||||||
|
generated `WorkDatabase_Impl` constructor; `app/proguard-rules.pro` now keeps it.
|
||||||
|
|
||||||
## 10. Privacy and security
|
## 10. Privacy and security
|
||||||
|
|
||||||
@@ -289,12 +299,28 @@ Never use `./gradlew --offline` for a fresh dependency check, and never commit
|
|||||||
`--add-exports`). Removing them breaks the data-layer tests on JDK 17+.
|
`--add-exports`). Removing them breaks the data-layer tests on JDK 17+.
|
||||||
9. **AOSP emulators do not have Play services.** An empty ad slot or a "purchases
|
9. **AOSP emulators do not have Play services.** An empty ad slot or a "purchases
|
||||||
unavailable" message there is expected; it is not a code failure.
|
unavailable" message there is expected; it is not a code failure.
|
||||||
10. **`versionCode` must increase** for every Play upload. `1.0.2` used 3; the
|
10. **`versionCode` must increase** for every Play upload. `1.0.2` used 3, the
|
||||||
freemium build is 4. Update `CHANGELOG.md` and the release checklist too.
|
1.1.0 internal-testing build used 4, the first 1.1.1 upload used 5, the corrected
|
||||||
|
1.1.1 freemium build used 6, and the foreground-service fix is `1.1.2` / 7. Update
|
||||||
|
`CHANGELOG.md` and the release checklist too.
|
||||||
11. **Do not call `navigationBarsPadding()` twice.** The bottom slot owns the inset;
|
11. **Do not call `navigationBarsPadding()` twice.** The bottom slot owns the inset;
|
||||||
`BottomActionBar` must not add it again.
|
`BottomActionBar` must not add it again.
|
||||||
12. **The old paid-app docs are historical.** Do not copy "pay once", "no ads" or
|
12. **The old paid-app docs are historical.** Do not copy "pay once", "no ads" or
|
||||||
"no INTERNET" claims into new copy.
|
"no INTERNET" claims into new copy.
|
||||||
|
13. **R8 reflects into Room/WorkManager.** `play-services-ads` pulls in WorkManager
|
||||||
|
2.7.0. The generated `androidx.work.impl.WorkDatabase_Impl` constructor is
|
||||||
|
removed by R8 unless `app/proguard-rules.pro` keeps it, producing a release-only
|
||||||
|
crash before `Application.onCreate`. Keep the rule and smoke-test a minified
|
||||||
|
build; debug builds do not reproduce it.
|
||||||
|
14. **Never `stopService()` a foreground start that may still be pending.** The
|
||||||
|
service's `onCreate`/`onStartCommand` run on the main thread, so a
|
||||||
|
`stopService()` issued straight after `startForegroundService()` (a scan that
|
||||||
|
finished at once, a Cancel tap, a stop from a `Dispatchers.Default` coroutine)
|
||||||
|
can win the race. The service then never calls `startForeground()` and Android
|
||||||
|
throws `RemoteServiceException$ForegroundServiceDidNotStartInTimeException` on
|
||||||
|
the app's main thread ~5–10 s later, with no app frames in the stack.
|
||||||
|
`ScanService` therefore enters the foreground in `onCreate()` and stops itself
|
||||||
|
from its own state collector; `ScanServiceTest` pins both halves down.
|
||||||
|
|
||||||
|
|
||||||
## 12. Definition of done
|
## 12. Definition of done
|
||||||
@@ -310,6 +336,8 @@ Never use `./gradlew --offline` for a fresh dependency check, and never commit
|
|||||||
- [ ] `./gradlew :app:assembleDebug` succeeds.
|
- [ ] `./gradlew :app:assembleDebug` succeeds.
|
||||||
- [ ] For release-affecting work: `./gradlew :app:assembleRelease` succeeds and the
|
- [ ] For release-affecting work: `./gradlew :app:assembleRelease` succeeds and the
|
||||||
merged manifest permissions are re-audited.
|
merged manifest permissions are re-audited.
|
||||||
|
- [ ] For release-affecting work: a **minified build launches** on a device (R8-only
|
||||||
|
failures are invisible to `assembleDebug` and unit tests).
|
||||||
- [ ] `docs/codemap.md` and `docs/codemap.mmd` are updated for architecture changes.
|
- [ ] `docs/codemap.md` and `docs/codemap.mmd` are updated for architecture changes.
|
||||||
- [ ] `README.md`, `PRIVACY.md`, `CHANGELOG.md`, `docs/MONETIZATION.md`,
|
- [ ] `README.md`, `PRIVACY.md`, `CHANGELOG.md`, `docs/MONETIZATION.md`,
|
||||||
`docs/STORE_LISTING.md` and `docs/PLAY_RELEASE_CHECKLIST.md` are updated when
|
`docs/STORE_LISTING.md` and `docs/PLAY_RELEASE_CHECKLIST.md` are updated when
|
||||||
@@ -346,8 +374,19 @@ Do **not**:
|
|||||||
- The machine may expose no `/dev/kvm`; AOSP AVDs run in software emulation. That is
|
- The machine may expose no `/dev/kvm`; AOSP AVDs run in software emulation. That is
|
||||||
fine for layout checks, but they have no Play services, so ads and Billing cannot
|
fine for layout checks, but they have no Play services, so ads and Billing cannot
|
||||||
be exercised there.
|
be exercised there.
|
||||||
- The real device used for earlier screenshots is MIUI, which denies `adb shell
|
- The real device used for earlier screenshots is MIUI (Xiaomi M2101K7AG, Android 12 /
|
||||||
input`; the debug broadcast hooks exist for that reason.
|
API 31). Observations from 2026-11-09, all worth keeping in mind:
|
||||||
|
- **`adb install` needs a tap on the phone.** MIUI asks for confirmation for a
|
||||||
|
sideloaded APK; if nobody taps it, the client reports
|
||||||
|
`Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]` even though
|
||||||
|
the transfer itself worked. Just run the install again and confirm on the device.
|
||||||
|
This applies to the minified release APK, which is not debuggable.
|
||||||
|
- `adb shell input tap`, `pm grant` and `uiautomator dump` *did* work in that
|
||||||
|
session, so try them before falling back to the debug broadcast hooks in
|
||||||
|
`src/debug/`; earlier sessions had `input`/`pm grant` refused, so treat both as
|
||||||
|
"attempt, then fall back" rather than as guaranteed either way.
|
||||||
|
- On API 31 grant `READ_EXTERNAL_STORAGE`; `READ_MEDIA_IMAGES` only exists from
|
||||||
|
API 33, so `pm grant … READ_MEDIA_IMAGES` fails with "Unknown permission" there.
|
||||||
- `local.properties` is machine-specific and git-ignored. Use
|
- `local.properties` is machine-specific and git-ignored. Use
|
||||||
`local.properties.example` as the template.
|
`local.properties.example` as the template.
|
||||||
- Release builds are signed only when `keystore.properties` exists; otherwise they
|
- Release builds are signed only when `keystore.properties` exists; otherwise they
|
||||||
|
|||||||
@@ -10,6 +10,48 @@ upload needs a **higher `versionCode`** than every previous upload.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [1.1.2] — 2026-11-09 · versionCode 7
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **`ForegroundServiceDidNotStartInTimeException` when a scan starts or cancels
|
||||||
|
quickly.** `ScanController` called `stopService()` from a background coroutine
|
||||||
|
immediately after `startForegroundService()` (a scan that finished at once, or a
|
||||||
|
Cancel tap). When that stop beat the pending foreground start, `ScanService` never
|
||||||
|
ran `startForeground()` and Android killed the process a few seconds later with
|
||||||
|
`RemoteServiceException$ForegroundServiceDidNotStartInTimeException` — a stack with
|
||||||
|
no app frames. The service now enters the foreground in `onCreate()` *and* at the
|
||||||
|
top of every `onStartCommand()` (before the Cancel early-return), tolerates a
|
||||||
|
`startForeground()` that the system refuses instead of crashing, and stops itself
|
||||||
|
once `ScanState.scanning` goes false; nothing outside it calls `stopService()`
|
||||||
|
anymore. Covered by the new Robolectric `ScanServiceTest`.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- **`versionName` 1.1.2 / `versionCode` 7.** `versionCode` 6 (1.1.1) is already on a
|
||||||
|
Play track, so the fix needs a new code.
|
||||||
|
|
||||||
|
## [1.1.1] — 2026-10-20 · versionCode 6
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **Release-only startup crash.** The minified release build died before
|
||||||
|
`Application.onCreate` in `androidx.startup.InitializationProvider` with
|
||||||
|
`Failed to create an instance of androidx.work.impl.WorkDatabase`. WorkManager
|
||||||
|
arrives transitively through `play-services-ads`, and R8 removed the generated
|
||||||
|
Room `WorkDatabase_Impl` no-argument constructor that Room invokes reflectively.
|
||||||
|
`app/proguard-rules.pro` now keeps that constructor. Debug builds were unaffected,
|
||||||
|
which is why the first internal-testing upload looked fine locally.
|
||||||
|
- **Release smoke testing.** `AGENTS.md` and `docs/PLAY_RELEASE_CHECKLIST.md` now
|
||||||
|
require launching a minified build before uploading; unit tests and
|
||||||
|
`assembleDebug` cannot catch R8-only startup failures.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- **`versionName` 1.1.1 / `versionCode` 6.** The 1.1.0 build (`versionCode` 4) crashed
|
||||||
|
on startup, and the first 1.1.1 build consumed `versionCode` 5 before this corrected
|
||||||
|
build was uploaded. Play has therefore used codes 4 and 5; this build takes 6.
|
||||||
|
|
||||||
## [1.1.0] — 2026-10-20 · versionCode 4
|
## [1.1.0] — 2026-10-20 · versionCode 4
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
google.com, pub-3909261635234286, DIRECT, f08c47fec0942fa0
|
||||||
@@ -89,8 +89,8 @@ android {
|
|||||||
applicationId = "de.softwareapp_hb.fotodup.finder.free"
|
applicationId = "de.softwareapp_hb.fotodup.finder.free"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 36
|
targetSdk = 36
|
||||||
versionCode = 4
|
versionCode = 7
|
||||||
versionName = "1.1.0"
|
versionName = "1.1.2"
|
||||||
|
|
||||||
// AdMob reads its application id from the manifest, so it has to be a placeholder:
|
// AdMob reads its application id from the manifest, so it has to be a placeholder:
|
||||||
// the value differs between a developer machine, CI and a release build.
|
// the value differs between a developer machine, CI and a release build.
|
||||||
|
|||||||
Vendored
+9
@@ -9,3 +9,12 @@
|
|||||||
|
|
||||||
# Coroutines: keep the internal classes R8 sometimes struggles to strip correctly.
|
# Coroutines: keep the internal classes R8 sometimes struggles to strip correctly.
|
||||||
-dontwarn kotlinx.coroutines.**
|
-dontwarn kotlinx.coroutines.**
|
||||||
|
|
||||||
|
# WorkManager 2.7.0 arrives transitively through play-services-ads and creates
|
||||||
|
# androidx.work.impl.WorkDatabase_Impl through Room's reflection. R8 removes the
|
||||||
|
# generated no-arg constructor because nothing calls it directly, which makes the
|
||||||
|
# app crash in androidx.startup.InitializationProvider with:
|
||||||
|
# Failed to create an instance of androidx.work.impl.WorkDatabase
|
||||||
|
-keep class androidx.work.impl.WorkDatabase_Impl {
|
||||||
|
public <init>();
|
||||||
|
}
|
||||||
|
|||||||
@@ -91,7 +91,11 @@ class ScanController(context: Context) {
|
|||||||
if (current.scanning) current.copy(scanning = false, phase = null) else current
|
if (current.scanning) current.copy(scanning = false, phase = null) else current
|
||||||
}
|
}
|
||||||
job = null
|
job = null
|
||||||
ScanService.stop(appContext)
|
// ScanService watches this state and stops itself once nothing is running.
|
||||||
|
// It is deliberately not stopped from here: a stopService() that lands
|
||||||
|
// while the foreground start is still pending on the main thread means the
|
||||||
|
// service never calls startForeground(), and the system then kills the app
|
||||||
|
// with ForegroundServiceDidNotStartInTimeException.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,7 +104,7 @@ class ScanController(context: Context) {
|
|||||||
job?.cancel()
|
job?.cancel()
|
||||||
job = null
|
job = null
|
||||||
_state.update { it.copy(scanning = false, phase = null) }
|
_state.update { it.copy(scanning = false, phase = null) }
|
||||||
ScanService.stop(appContext)
|
// As in start(): the service stops itself, see the comment there.
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onProgress(progress: ScanProgress) {
|
private fun onProgress(progress: ScanProgress) {
|
||||||
|
|||||||
@@ -9,11 +9,13 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.ServiceInfo
|
import android.content.pm.ServiceInfo
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
|
import android.util.Log
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
import androidx.core.app.ServiceCompat
|
import androidx.core.app.ServiceCompat
|
||||||
import de.softwareapp_hb.fotodup.finder.FotoDupApplication
|
import de.softwareapp_hb.fotodup.finder.FotoDupApplication
|
||||||
import de.softwareapp_hb.fotodup.finder.MainActivity
|
import de.softwareapp_hb.fotodup.finder.MainActivity
|
||||||
import de.softwareapp_hb.fotodup.finder.R
|
import de.softwareapp_hb.fotodup.finder.R
|
||||||
|
import de.softwareapp_hb.fotodup.finder.domain.ScanController
|
||||||
import de.softwareapp_hb.fotodup.finder.domain.ScanState
|
import de.softwareapp_hb.fotodup.finder.domain.ScanState
|
||||||
import de.softwareapp_hb.fotodup.finder.text.labelRes
|
import de.softwareapp_hb.fotodup.finder.text.labelRes
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
@@ -31,24 +33,43 @@ import kotlinx.coroutines.launch
|
|||||||
* ongoing notification. The notification is also how the user cancels a long scan, and
|
* ongoing notification. The notification is also how the user cancels a long scan, and
|
||||||
* its presence is what stops Android from freezing the app's process when the app is not
|
* its presence is what stops Android from freezing the app's process when the app is not
|
||||||
* visible.
|
* visible.
|
||||||
|
*
|
||||||
|
* ### The foreground contract
|
||||||
|
*
|
||||||
|
* A service started with `startForegroundService()` must call `startForeground()` within a
|
||||||
|
* few seconds, otherwise the system throws
|
||||||
|
* `RemoteServiceException.ForegroundServiceDidNotStartInTimeException`. That is why
|
||||||
|
* [enterForeground] runs in [onCreate] *and* at the top of every [onStartCommand], before
|
||||||
|
* any early return: a start that is cancelled or stopped straight away still has to honour
|
||||||
|
* the contract. For the same reason the service is never stopped from outside with
|
||||||
|
* `stopService()` — an external stop can land while the start is still pending and then the
|
||||||
|
* service never gets to call `startForeground()` at all. It stops *itself* as soon as it
|
||||||
|
* observes that no scan is running.
|
||||||
*/
|
*/
|
||||||
class ScanService : Service() {
|
class ScanService : Service() {
|
||||||
|
|
||||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
||||||
private var observer: Job? = null
|
private var observer: Job? = null
|
||||||
|
|
||||||
|
/** The scan owner; always present, the application creates it in `onCreate()`. */
|
||||||
|
private val controller: ScanController
|
||||||
|
get() = (application as FotoDupApplication).scanController
|
||||||
|
|
||||||
override fun onBind(intent: Intent?): IBinder? = null
|
override fun onBind(intent: Intent?): IBinder? = null
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
createChannel()
|
createChannel()
|
||||||
|
// Enter the foreground as early as the framework allows: the system's timer starts
|
||||||
|
// when startForegroundService() is called, and onCreate() always runs before
|
||||||
|
// onStartCommand(). Doing it here means even a start that is never handled (because
|
||||||
|
// the scan finished first) still satisfies the contract.
|
||||||
|
enterForeground(controller.state.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The service-type constant is inlined at compile time, so referencing it on older
|
|
||||||
// devices is harmless — ServiceCompat ignores the type below API 29.
|
|
||||||
@Suppress("InlinedApi")
|
|
||||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||||
val controller = (application as FotoDupApplication).scanController
|
// First thing on every start, including the ones that stop again immediately.
|
||||||
|
val inForeground = enterForeground(controller.state.value)
|
||||||
|
|
||||||
if (intent?.action == ACTION_CANCEL) {
|
if (intent?.action == ACTION_CANCEL) {
|
||||||
controller.cancel()
|
controller.cancel()
|
||||||
@@ -56,26 +77,14 @@ class ScanService : Service() {
|
|||||||
return START_NOT_STICKY
|
return START_NOT_STICKY
|
||||||
}
|
}
|
||||||
|
|
||||||
// This must happen within a few seconds of startForegroundService(), so it is
|
if (!inForeground || !controller.state.value.scanning) {
|
||||||
// the very first thing we do.
|
// Nothing will ever need this service again (stale notification, a scan that
|
||||||
ServiceCompat.startForeground(
|
// already finished). startForeground() above has been satisfied already.
|
||||||
this,
|
stopEverything()
|
||||||
NOTIFICATION_ID,
|
return START_NOT_STICKY
|
||||||
buildNotification(controller.state.value),
|
|
||||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC,
|
|
||||||
)
|
|
||||||
|
|
||||||
if (observer == null) {
|
|
||||||
observer = scope.launch {
|
|
||||||
controller.state.collect { state ->
|
|
||||||
if (state.scanning) {
|
|
||||||
notifyProgress(state)
|
|
||||||
} else {
|
|
||||||
stopEverything()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
observe()
|
||||||
return START_NOT_STICKY
|
return START_NOT_STICKY
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +93,7 @@ class ScanService : Service() {
|
|||||||
* 24). If that ever fires, stop cleanly rather than let the system kill the app.
|
* 24). If that ever fires, stop cleanly rather than let the system kill the app.
|
||||||
*/
|
*/
|
||||||
override fun onTimeout(startId: Int, fgsType: Int) {
|
override fun onTimeout(startId: Int, fgsType: Int) {
|
||||||
(application as FotoDupApplication).scanController.cancel()
|
controller.cancel()
|
||||||
stopEverything()
|
stopEverything()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,14 +103,76 @@ class ScanService : Service() {
|
|||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Posts the progress notification and tells the system this is a foreground service.
|
||||||
|
*
|
||||||
|
* Must happen within a few seconds of `startForegroundService()`, so callers invoke it
|
||||||
|
* before doing anything else. A failure only costs the foreground guarantee — the scan
|
||||||
|
* itself keeps running — so nothing is allowed to escape into the main thread.
|
||||||
|
*
|
||||||
|
* @return true when the service really is in the foreground.
|
||||||
|
*/
|
||||||
|
// ForegroundServiceStartNotAllowedException (app slipped into the background before the
|
||||||
|
// service ran), SecurityException (service type or permission missing) and
|
||||||
|
// MissingForegroundServiceTypeException (API 34+) are all RuntimeExceptions, and a
|
||||||
|
// throwing notification builder is just as fatal. Catching the whole family is
|
||||||
|
// deliberate here: a crash on this path is exactly what we are fixing.
|
||||||
|
@Suppress("TooGenericExceptionCaught", "InlinedApi")
|
||||||
|
private fun enterForeground(state: ScanState): Boolean {
|
||||||
|
val notification = try {
|
||||||
|
buildNotification(state)
|
||||||
|
} catch (e: RuntimeException) {
|
||||||
|
Log.w(TAG, "Could not build the scan notification", e)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return try {
|
||||||
|
// The service-type constant is inlined at compile time, so referencing it on
|
||||||
|
// older devices is harmless: ServiceCompat ignores the type below API 29.
|
||||||
|
ServiceCompat.startForeground(
|
||||||
|
this,
|
||||||
|
NOTIFICATION_ID,
|
||||||
|
notification,
|
||||||
|
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC,
|
||||||
|
)
|
||||||
|
true
|
||||||
|
} catch (e: RuntimeException) {
|
||||||
|
Log.w(TAG, "Could not enter the foreground", e)
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Mirrors the controller's progress into the notification until the scan is over. */
|
||||||
|
private fun observe() {
|
||||||
|
if (observer != null) return
|
||||||
|
observer = scope.launch {
|
||||||
|
controller.state.collect { state ->
|
||||||
|
if (state.scanning) {
|
||||||
|
notifyProgress(state)
|
||||||
|
} else {
|
||||||
|
// Re-read the newest state: a late emission must not stop a scan that
|
||||||
|
// was started while this one was in flight.
|
||||||
|
if (!controller.state.value.scanning) stopEverything()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun stopEverything() {
|
private fun stopEverything() {
|
||||||
|
observer = null
|
||||||
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE)
|
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE)
|
||||||
stopSelf()
|
stopSelf()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun notifyProgress(state: ScanState) {
|
private fun notifyProgress(state: ScanState) {
|
||||||
getSystemService(NotificationManager::class.java)
|
// A rejected notification must not kill this collector: it is also what stops the
|
||||||
?.notify(NOTIFICATION_ID, buildNotification(state))
|
// service, so the scan matters more than the progress bar. Same rationale (and same
|
||||||
|
// exception family) as enterForeground().
|
||||||
|
try {
|
||||||
|
getSystemService(NotificationManager::class.java)
|
||||||
|
?.notify(NOTIFICATION_ID, buildNotification(state))
|
||||||
|
} catch (e: RuntimeException) {
|
||||||
|
Log.w(TAG, "Could not update the scan notification", e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildNotification(state: ScanState): Notification {
|
private fun buildNotification(state: ScanState): Notification {
|
||||||
@@ -157,15 +228,25 @@ class ScanService : Service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
private const val TAG = "FotoDupScanService"
|
||||||
private const val CHANNEL_ID = "scan_progress"
|
private const val CHANNEL_ID = "scan_progress"
|
||||||
private const val NOTIFICATION_ID = 1
|
private const val NOTIFICATION_ID = 1
|
||||||
private const val PROGRESS_MAX = 100
|
private const val PROGRESS_MAX = 100
|
||||||
private const val ACTION_CANCEL = "de.softwareapp_hb.fotodup.finder.action.CANCEL_SCAN"
|
|
||||||
|
/** Action of the notification's Cancel button; also handled as a direct start. */
|
||||||
|
internal const val ACTION_CANCEL = "de.softwareapp_hb.fotodup.finder.action.CANCEL_SCAN"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asks the system to run the service. Safe to call from the background: if the
|
* Asks the system to run the service. Safe to call from the background: if the
|
||||||
* start is not permitted the exception is swallowed, because the scan itself does
|
* start is not permitted the exception is swallowed, because the scan itself does
|
||||||
* not depend on the service — it only loses the foreground guarantee.
|
* not depend on the service — it only loses the foreground guarantee.
|
||||||
|
*
|
||||||
|
* There is deliberately no counterpart that stops the service from here. The
|
||||||
|
* service stops itself as soon as [de.softwareapp_hb.fotodup.finder.domain.ScanController]
|
||||||
|
* reports that no scan is running, because an external `stopService()` can arrive
|
||||||
|
* while this foreground start is still pending on the main thread — and then
|
||||||
|
* `startForeground()` is never called, which is what the system punishes with
|
||||||
|
* `ForegroundServiceDidNotStartInTimeException`.
|
||||||
*/
|
*/
|
||||||
fun start(context: Context) {
|
fun start(context: Context) {
|
||||||
try {
|
try {
|
||||||
@@ -174,9 +255,5 @@ class ScanService : Service() {
|
|||||||
// e.g. ForegroundServiceStartNotAllowedException on Android 12+.
|
// e.g. ForegroundServiceStartNotAllowedException on Android 12+.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun stop(context: Context) {
|
|
||||||
context.stopService(Intent(context, ScanService::class.java))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
package de.softwareapp_hb.fotodup.finder.service
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.content.pm.ServiceInfo
|
||||||
|
import de.softwareapp_hb.fotodup.finder.FotoDupApplication
|
||||||
|
import org.junit.Assert.assertFalse
|
||||||
|
import org.junit.Assert.assertNotNull
|
||||||
|
import org.junit.Assert.assertNull
|
||||||
|
import org.junit.Assert.assertTrue
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
import org.robolectric.Robolectric
|
||||||
|
import org.robolectric.RobolectricTestRunner
|
||||||
|
import org.robolectric.RuntimeEnvironment
|
||||||
|
import org.robolectric.Shadows.shadowOf
|
||||||
|
import org.robolectric.annotation.Config
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Guards the foreground-service contract of [ScanService].
|
||||||
|
*
|
||||||
|
* `startForegroundService()` obliges the service to call `startForeground()` within a few
|
||||||
|
* seconds; if it never happens Android kills the app's process with
|
||||||
|
* `RemoteServiceException.ForegroundServiceDidNotStartInTimeException`. The service used to
|
||||||
|
* do that only at the top of `onStartCommand()`, after the Cancel early-return, and
|
||||||
|
* [de.softwareapp_hb.fotodup.finder.domain.ScanController] additionally called
|
||||||
|
* `stopService()` from a background coroutine — which can beat the pending start and leave
|
||||||
|
* `startForeground()` un-called entirely. These tests pin the fixed behaviour down.
|
||||||
|
*/
|
||||||
|
@RunWith(RobolectricTestRunner::class)
|
||||||
|
@Config(sdk = [36], application = FotoDupApplication::class)
|
||||||
|
class ScanServiceTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `onCreate enters the foreground before any command arrives`() {
|
||||||
|
val service = Robolectric.buildService(ScanService::class.java).create().get()
|
||||||
|
|
||||||
|
val shadow = shadowOf(service)
|
||||||
|
assertNotNull(
|
||||||
|
"startForeground() must run in onCreate(), or a start that is never handled " +
|
||||||
|
"leaves the system waiting for it",
|
||||||
|
shadow.lastForegroundNotification,
|
||||||
|
)
|
||||||
|
assertFalse("the service must still be in the foreground", shadow.isForegroundStopped)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `a start with no running scan calls startForeground and then stops itself`() {
|
||||||
|
// No scan is in flight, so the service is useless the moment it starts. This is the
|
||||||
|
// exact path that used to return early without entering the foreground.
|
||||||
|
val controller = Robolectric.buildService(ScanService::class.java)
|
||||||
|
.create()
|
||||||
|
.startCommand(0, 1)
|
||||||
|
|
||||||
|
val shadow = shadowOf(controller.get())
|
||||||
|
// The notification itself is gone again once the service stopForeground()s, but the
|
||||||
|
// recorded id proves startForeground() ran before it stopped.
|
||||||
|
assertTrue(
|
||||||
|
"even a start that stops immediately has to satisfy startForegroundService()",
|
||||||
|
shadow.lastForegroundNotificationId != 0,
|
||||||
|
)
|
||||||
|
assertTrue("the idle service must stop itself", shadow.isStoppedBySelf)
|
||||||
|
assertTrue("the foreground state must be released", shadow.isForegroundStopped)
|
||||||
|
assertTrue("the notification must be removed", shadow.notificationShouldRemoved)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `the notification cancel action also satisfies the foreground contract`() {
|
||||||
|
val app = RuntimeEnvironment.getApplication() as FotoDupApplication
|
||||||
|
val cancelIntent = Intent(app, ScanService::class.java).setAction(ScanService.ACTION_CANCEL)
|
||||||
|
|
||||||
|
val controller = Robolectric.buildService(ScanService::class.java).create()
|
||||||
|
val service = controller.get()
|
||||||
|
service.onStartCommand(cancelIntent, 0, 1)
|
||||||
|
|
||||||
|
val shadow = shadowOf(service)
|
||||||
|
assertTrue(
|
||||||
|
"the cancel path must not skip startForeground()",
|
||||||
|
shadow.lastForegroundNotificationId != 0,
|
||||||
|
)
|
||||||
|
assertTrue("cancelling stops the service", shadow.isStoppedBySelf)
|
||||||
|
assertFalse("cancelling leaves no scan running", app.scanController.state.value.scanning)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `a failing startForeground stops the service instead of crashing`() {
|
||||||
|
// e.g. ForegroundServiceStartNotAllowedException when the app slipped into the
|
||||||
|
// background before the service ran, or a missing dataSync permission.
|
||||||
|
val controller = Robolectric.buildService(ScanService::class.java)
|
||||||
|
shadowOf(controller.get()).setThrowInStartForeground(SecurityException("not allowed"))
|
||||||
|
|
||||||
|
controller.create().startCommand(0, 1)
|
||||||
|
|
||||||
|
val shadow = shadowOf(controller.get())
|
||||||
|
assertNull("nothing was posted", shadow.lastForegroundNotification)
|
||||||
|
assertTrue("the service gives up quietly", shadow.isStoppedBySelf)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `the Android 15 dataSync timeout cancels the scan and stops the service`() {
|
||||||
|
val app = RuntimeEnvironment.getApplication() as FotoDupApplication
|
||||||
|
val controller = Robolectric.buildService(ScanService::class.java).create()
|
||||||
|
|
||||||
|
controller.get().onTimeout(1, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)
|
||||||
|
|
||||||
|
assertFalse(app.scanController.state.value.scanning)
|
||||||
|
assertTrue(shadowOf(controller.get()).isStoppedBySelf)
|
||||||
|
}
|
||||||
|
}
|
||||||
+32
-1
@@ -49,7 +49,38 @@ and ad-request APIs differ.
|
|||||||
`requestConsentInfoUpdate()` → `loadAndShowConsentFormIfRequired()` before
|
`requestConsentInfoUpdate()` → `loadAndShowConsentFormIfRequired()` before
|
||||||
`MobileAds.initialize()`.
|
`MobileAds.initialize()`.
|
||||||
5. Optional but recommended: publish an `app-ads.txt` on the developer website that
|
5. Optional but recommended: publish an `app-ads.txt` on the developer website that
|
||||||
Play points to. It is a website file, not an app asset.
|
Play points to. It is a website file, not an app asset. The copy in the repo root
|
||||||
|
lists `pub-…`, so the file must be served from the root of that domain, not from
|
||||||
|
this repository.
|
||||||
|
6. **App verification and the ad-serving review are two different gates.** Once the
|
||||||
|
AdMob app is verified, AdMob still reviews it before full ad serving, which
|
||||||
|
typically takes 2–3 days and can take longer. Ad serving is **limited** in that
|
||||||
|
window, so a missing or low-fill banner right after verification is expected and
|
||||||
|
is not evidence of a bug. Do not react by adding ad units, disabling the banner
|
||||||
|
gate or hammering requests; check the AdMob inbox for the review result and only
|
||||||
|
judge fill rate after it clears.
|
||||||
|
|
||||||
|
### 2.1 CMP and consent messages
|
||||||
|
|
||||||
|
The app already ships the UMP SDK, which is one of Google's certified CMPs. It
|
||||||
|
displays whatever *Privacy & messaging* serves, including the Google CMP messages
|
||||||
|
that **Maximize message coverage** auto-creates for a new app — no app change is
|
||||||
|
needed when a message is added, edited or re-published. `AdsController` requests the
|
||||||
|
consent update, shows `loadAndShowConsentFormIfRequired()` and only then initialises
|
||||||
|
the ad SDK.
|
||||||
|
|
||||||
|
Messages to have before the banner is expected to work in every region:
|
||||||
|
|
||||||
|
| Message | Region | Notes |
|
||||||
|
|---|---|---|
|
||||||
|
| European regulations (GDPR) | EEA, UK, Switzerland | Personalised ads + the privacy-options form. Must be **published**; a draft is invisible to the SDK |
|
||||||
|
| US states (IAB US Privacy / GPP) | US state privacy laws | Only relevant if the app is distributed there |
|
||||||
|
| Privacy options | wherever UMP reports `privacyOptionsRequirementStatus == REQUIRED` | Already wired: *Options > Privacy options* → `showPrivacyOptionsForm()` |
|
||||||
|
|
||||||
|
An unpublished message means no form is shown; whether the app may then request an
|
||||||
|
ad is decided by `canRequestAds()`, and Google may fall back to a generic consent
|
||||||
|
message in the EEA/UK/CH. Do not rely on that fallback: publish the message and
|
||||||
|
verify the flow with a debug device set to the EEA (see §9).
|
||||||
|
|
||||||
## 3. Play Console setup
|
## 3. Play Console setup
|
||||||
|
|
||||||
|
|||||||
@@ -12,15 +12,16 @@ the rest are things you must do in the Play Console / with your own accounts.
|
|||||||
`namespace` deliberately stay `de.softwareapp_hb.fotodup.finder`, and debug builds
|
`namespace` deliberately stay `de.softwareapp_hb.fotodup.finder`, and debug builds
|
||||||
append `.debug` → `de.softwareapp_hb.fotodup.finder.free.debug`.
|
append `.debug` → `de.softwareapp_hb.fotodup.finder.free.debug`.
|
||||||
- [x] Generate an **upload keystore** (keep it safe; if you lose it you cannot
|
- [x] Generate an **upload keystore** (keep it safe; if you lose it you cannot
|
||||||
publish updates) — **[code]** done: `fotodup-upload.jks` in the project root
|
publish updates) — **[code]** done: `fotodup-upload.jks` in the central keystore
|
||||||
(git-ignored, `alias upload`), `CN=Hadrian Burkhardt, L=Potsdam, C=DE`.
|
folder `/home/ubuntu/keystore/` (outside the repo, mode `600`, shared with the paid
|
||||||
|
listing, `alias upload`), `CN=Hadrian Burkhardt, L=Potsdam, C=DE`.
|
||||||
- [x] Copy `keystore.properties.example` to `keystore.properties` and fill it in.
|
- [x] Copy `keystore.properties.example` to `keystore.properties` and fill it in.
|
||||||
**[code]** done — the file is in place, and the Gradle build picks it up automatically and
|
**[code]** done — the file is in place, and the Gradle build picks it up automatically and
|
||||||
signs release builds; without it the release APK stays unsigned.
|
signs release builds; without it the release APK stays unsigned.
|
||||||
- [ ] Enable **Play App Signing** for the **new** app in the Play Console and upload the
|
- [ ] Enable **Play App Signing** for the **new** app in the Play Console and upload the
|
||||||
certificate of your *upload* key (the same upload key can sign both listings):
|
certificate of your *upload* key (the same upload key can sign both listings):
|
||||||
```bash
|
```bash
|
||||||
keytool -exportcert -alias upload -keystore fotodup-upload.jks -rfc > upload_cert.pem
|
keytool -exportcert -alias upload -keystore /home/ubuntu/keystore/fotodup-upload.jks -rfc > upload_cert.pem
|
||||||
```
|
```
|
||||||
Upload key fingerprint (SHA-256), to confirm the right key was registered:
|
Upload key fingerprint (SHA-256), to confirm the right key was registered:
|
||||||
`AA:8C:3D:6C:D0:55:46:50:48:ED:04:3E:AF:34:2B:66:B4:13:87:C9:E0:DA:29:70:5A:0D:18:47:08:1A:4C:7A`.
|
`AA:8C:3D:6C:D0:55:46:50:48:ED:04:3E:AF:34:2B:66:B4:13:87:C9:E0:DA:29:70:5A:0D:18:47:08:1A:4C:7A`.
|
||||||
@@ -30,10 +31,12 @@ the rest are things you must do in the Play Console / with your own accounts.
|
|||||||
|
|
||||||
## 2. Versioning
|
## 2. Versioning
|
||||||
|
|
||||||
- [x] Set `versionName` (user-visible) **[code]** — `1.1.0` in `app/build.gradle.kts`.
|
- [x] Set `versionName` (user-visible) **[code]** — `1.1.2` in `app/build.gradle.kts`.
|
||||||
- [x] `versionCode` **[code]** — currently **4**. It is the counter Play orders uploads by, and
|
- [x] `versionCode` **[code]** — currently **7**. It is the counter Play orders uploads by, and
|
||||||
every later upload must be higher. Codes 1–3 were consumed by 1.0.0–1.0.2, so the
|
every later upload must be higher. Codes 1–3 were consumed by 1.0.0–1.0.2, **4** by
|
||||||
freemium build takes **4**.
|
the 1.1.0 internal-testing build (which crashed on startup), **5** by an earlier
|
||||||
|
1.1.1 upload, and **6** by the corrected freemium build that is already on a track, so
|
||||||
|
this foreground-service fix takes **7**.
|
||||||
|
|
||||||
## 3. Build the release artefacts
|
## 3. Build the release artefacts
|
||||||
|
|
||||||
@@ -42,17 +45,44 @@ the rest are things you must do in the Play Console / with your own accounts.
|
|||||||
./gradlew :app:assembleRelease # -> APK for local testing
|
./gradlew :app:assembleRelease # -> APK for local testing
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Build and record the 1.1.0 artefacts.** The 1.0.2 record is historical
|
- [x] **Build and record the 1.1.1 artefacts.** The 1.0.2 record is historical
|
||||||
(2,940,935 bytes, `sha256 534e5ae9…`). The freemium build adds the ads/UMP/Billing
|
(2,940,935 bytes, `sha256 534e5ae9…`). The freemium build adds the ads/UMP/Billing
|
||||||
dependencies and the AdMob manifest entry, so its size and hash must be re-measured
|
dependencies and the AdMob manifest entry, so its size and hash must be re-measured
|
||||||
after real AdMob ids are configured. Verify the release APK reports package
|
after real AdMob ids are configured. Verify the release APK reports package
|
||||||
`de.softwareapp_hb.fotodup.finder.free`, `versionCode=4 versionName=1.1.0
|
`de.softwareapp_hb.fotodup.finder.free`, `versionCode=6 versionName=1.1.1
|
||||||
targetSdk=36` and the permission set in step 5 (including `INTERNET`, `AD_ID` and
|
targetSdk=36` and the permission set in step 5 (including `INTERNET`, `AD_ID` and
|
||||||
`BILLING`).
|
`BILLING`).
|
||||||
Local validation with the default test ids (2026-10-20): APK 3,655,562 bytes,
|
The 1.1.0 validation build (`versionCode` 4, test ids) was a 3,655,562-byte APK /
|
||||||
`sha256 931d2b21…`; signed AAB 7,680,301 bytes, `sha256 03abb548…`.
|
7,680,301-byte AAB, but it **crashed on launch** and must not be reused:
|
||||||
Re-measure both after setting the real ids/cutoff — the ids change the manifest and
|
R8 removed `androidx.work.impl.WorkDatabase_Impl`'s no-arg constructor, which
|
||||||
therefore the artefacts.
|
WorkManager creates reflectively from `androidx.startup.InitializationProvider`.
|
||||||
|
`app/proguard-rules.pro` now keeps it. The current 1.1.1 / versionCode 6 build
|
||||||
|
(real AdMob ids and `legacyPro.cutoffEpochMs=1792504293000`) is a 3,688,330-byte
|
||||||
|
APK (`sha256 6043ec92…`) / 7,752,264-byte AAB (`sha256 4766ca49…`); `dexdump`
|
||||||
|
confirms the `WorkDatabase_Impl` public no-arg constructor is present. Rebuild
|
||||||
|
and re-measure if the ids or cutoff change.
|
||||||
|
- [x] **Build and record the 1.1.2 artefacts** (the `ForegroundServiceDidNotStartInTime`
|
||||||
|
fix; same real ids and cutoff as 1.1.1, so the size moved by the code alone): a
|
||||||
|
**3,688,330**-byte APK (`sha256 5d43c515…`) and a **7,753,331**-byte AAB
|
||||||
|
(`sha256 51c83829…`), signed with the upload key from step 1
|
||||||
|
(`CN=Hadrian Burkhardt`, SHA-256 `AA:8C:3D:…:1A:4C:7A`) and R8-minified.
|
||||||
|
`jarsigner -verify` says *jar verified* for the `.aab`; `aapt2 dump badging`
|
||||||
|
reports package `de.softwareapp_hb.fotodup.finder.free`,
|
||||||
|
`versionCode=7 versionName=1.1.2 targetSdk=36`; the merged release manifest
|
||||||
|
contains no AdMob test id. Rebuild and re-measure after any code, id or cutoff
|
||||||
|
change.
|
||||||
|
- [x] **Launch the minified build before uploading.** Do not rely on
|
||||||
|
`assembleDebug`/unit tests: they do not run R8. Install the release APK on a
|
||||||
|
real device (or a temporarily minified debug build side by side) and confirm it
|
||||||
|
gets past the splash screen to the scanner/UMP consent. See `AGENTS.md` §9.
|
||||||
|
✅ Done for **1.1.2 / versionCode 7** on 2026-11-09 (Xiaomi M2101K7AG, Android 12 /
|
||||||
|
API 31): the signed release APK starts past
|
||||||
|
`androidx.startup.InitializationProvider`, renders the UMP form, scans and cancels
|
||||||
|
without a crash. Two MIUI details: it asks for a **confirmation tap** on the phone
|
||||||
|
for a sideloaded APK (otherwise adb reports
|
||||||
|
`INSTALL_FAILED_USER_RESTRICTED: Install canceled by user` — just rerun it and
|
||||||
|
confirm), and the **Play-signed copy has to be uninstalled first**, because the
|
||||||
|
upload key cannot update it.
|
||||||
- [ ] Upload the **`.aab`** (not the APK) to the Play Console.
|
- [ ] Upload the **`.aab`** (not the APK) to the Play Console.
|
||||||
⚠️ **Expect a native-debug-symbols warning here, and ignore it.** Play scans the bundle, finds
|
⚠️ **Expect a native-debug-symbols warning here, and ignore it.** Play scans the bundle, finds
|
||||||
`base/lib/<abi>/libandroidx.graphics.path.so`, and reports *"This App Bundle contains native
|
`base/lib/<abi>/libandroidx.graphics.path.so`, and reports *"This App Bundle contains native
|
||||||
@@ -90,9 +120,15 @@ action except the items marked **[code]**.
|
|||||||
2. *Monetise > Products > In-app products* → create **`pro_no_ads`**, type **One-time
|
2. *Monetise > Products > In-app products* → create **`pro_no_ads`**, type **One-time
|
||||||
product**, set the price, **Activate** it. The product id must match
|
product**, set the price, **Activate** it. The product id must match
|
||||||
`ProProduct.ID` exactly; an inactive product is not returned by Play.
|
`ProProduct.ID` exactly; an inactive product is not returned by Play.
|
||||||
3. AdMob → create/link the Android app, one **Banner** unit and a **UMP message**.
|
3. AdMob → link the Android app (`…finder.free`), create one **Banner** unit, and
|
||||||
Put the ids in `local.properties` (`admob.appId`, `admob.bannerUnitId`) or pass
|
**publish** a UMP message under *Privacy & messaging* (the European-regulations
|
||||||
`-Padmob.appId=...`; never commit them.
|
message that *Maximize message coverage* auto-creates is fine once it is
|
||||||
|
published, not a draft). Put the ids in `local.properties` (`admob.appId`,
|
||||||
|
`admob.bannerUnitId`) or pass `-Padmob.appId=...`; never commit them. Host
|
||||||
|
`app-ads.txt` at the root of the developer website listed on the Play listing.
|
||||||
|
App verification is followed by a separate AdMob ad-serving review (2–3 days,
|
||||||
|
sometimes longer) with **limited serving** until it clears: an empty banner in
|
||||||
|
that window is expected, not a code defect.
|
||||||
4. Set `legacyPro.cutoffEpochMs` to the instant of the first freemium release.
|
4. Set `legacyPro.cutoffEpochMs` to the instant of the first freemium release.
|
||||||
Installs older than that are grandfathered into Pro; a `0` cutoff disables the
|
Installs older than that are grandfathered into Pro; a `0` cutoff disables the
|
||||||
migration. Because the new app has a different applicationId, this only works
|
migration. Because the new app has a different applicationId, this only works
|
||||||
@@ -452,7 +488,11 @@ action except the items marked **[code]**.
|
|||||||
virtual instruction counter dilates the guest clock and made it work exactly once
|
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
|
(`-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`
|
reproducibly, so that is a lead rather than a recipe; `SETTLE_SECONDS` / `WARM_SECONDS`
|
||||||
scale this script's waits if it is ever retried.
|
scale this script's waits if it is ever retried. Note that part of that crash was a real
|
||||||
|
app bug (see pitfall 14 in `AGENTS.md`): a scan that reports idle straight away used to
|
||||||
|
let `stopService()` beat the pending foreground start, so `startForeground()` was never
|
||||||
|
called. Since the fix, that specific race no longer occurs and `ScanServiceTest` covers
|
||||||
|
it, but the emulator remains too slow to prove a *device* recording.
|
||||||
|
|
||||||
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.
|
||||||
@@ -491,6 +531,12 @@ action except the items marked **[code]**.
|
|||||||
|
|
||||||
- [ ] Create an **internal testing** track and add yourself as a tester; install via
|
- [ ] Create an **internal testing** track and add yourself as a tester; install via
|
||||||
the Play link on a real device.
|
the Play link on a real device.
|
||||||
|
- [ ] **Confirm the first screen appears.** The 1.1.0 upload (`versionCode` 4) installed
|
||||||
|
but crashed before `Application.onCreate`; versionCode 6 keeps WorkManager's
|
||||||
|
`WorkDatabase_Impl` constructor so it gets past
|
||||||
|
`androidx.startup.InitializationProvider`. If a future release crashes the same
|
||||||
|
way, check the R8 keep rule and `app/build/outputs/mapping/release/usage.txt` for
|
||||||
|
`WorkDatabase_Impl`.
|
||||||
- [ ] Test on the oldest supported Android version you can (minSdk 26) and on the
|
- [ ] Test on the oldest supported Android version you can (minSdk 26) and on the
|
||||||
newest you have (Android 16 / API 36).
|
newest you have (Android 16 / API 36).
|
||||||
- [ ] Test the permission flows:
|
- [ ] Test the permission flows:
|
||||||
@@ -517,12 +563,27 @@ action except the items marked **[code]**.
|
|||||||
still **19 groups / 47 photos / 40.1 MB**. Buy Pro still reports “purchases
|
still **19 groups / 47 photos / 40.1 MB**. Buy Pro still reports “purchases
|
||||||
unavailable” because this debug build was sideloaded and `pro_no_ads` is not active
|
unavailable” because this debug build was sideloaded and `pro_no_ads` is not active
|
||||||
on the internal track yet; that is the expected gate, not a crash.
|
on the internal track yet; that is the expected gate, not a crash.
|
||||||
|
- [x] **1.1.2 foreground-service fix on the real phone** (Xiaomi M2101K7AG, Android 12 /
|
||||||
|
API 31; minified release APK *and* debug build): cold scan **5,379 photos → 19 groups
|
||||||
|
/ 47 photos / 40.1 MB in 16.3 s** (signatures 1.6 s · exact 32 ms · similar 14.2 s,
|
||||||
|
cut fitted to ≤ 10 bits, 5 unreadable); warm debug scans 2.1 s / 1.8 s. **Cancel** was
|
||||||
|
exercised three ways — the in-app button mid-scan, the notification's CANCEL action,
|
||||||
|
and a scan that finished inside the old `stopService()` window — and every time the
|
||||||
|
process kept its pid, `ScanService` stopped **itself**, and logcat had **no**
|
||||||
|
`ForegroundServiceDidNotStartInTimeException`, `RemoteServiceException` or `FATAL
|
||||||
|
EXCEPTION`. The banner request reached AdMob and returned **No fill**, which is
|
||||||
|
expected while the ad-serving review is pending (see the review note in
|
||||||
|
[MONETIZATION](MONETIZATION.md) § 2, step 6). Not exercised: the delete flow,
|
||||||
|
because that would remove real photos from the device — tap through it manually
|
||||||
|
once.
|
||||||
- [ ] Verify no crashes in *Play Console > Quality > Android vitals* after rollout.
|
- [ ] Verify no crashes in *Play Console > Quality > Android vitals* after rollout.
|
||||||
|
|
||||||
## 7. Release notes ("What's new") and rollout
|
## 7. Release notes ("What's new") and rollout
|
||||||
|
|
||||||
⚠️ **Which block applies:** the freemium app is a **new `.free` listing**, so its first
|
⚠️ **Which block applies:** the freemium app is a **new `.free` listing**, so its first
|
||||||
release uses the “new freemium listing” block below. The 1.0.2 and initial-release
|
release uses the “new freemium listing” block below. **The current upload is the 1.1.2
|
||||||
|
update, so use the 1.1.2 block** (its notes belong to that release; the first-release
|
||||||
|
block stays here for the listing's initial submission). The 1.0.2 and initial-release
|
||||||
blocks are kept for the history of the old paid listing; the old initial block still
|
blocks are kept for the history of the old paid listing; the old initial block still
|
||||||
says “no ads”, which was true only of the paid build. The 1.1.0-update block has been
|
says “no ads”, which was true only of the paid build. The 1.1.0-update block has been
|
||||||
replaced because the plan is a new listing, not an in-place price change.
|
replaced because the plan is a new listing, not an in-place price change.
|
||||||
@@ -549,6 +610,25 @@ Rules (per Google's *Prepare and roll out a release* guide):
|
|||||||
- For app updates list only user-visible changes; the full developer history belongs
|
- For app updates list only user-visible changes; the full developer history belongs
|
||||||
in [CHANGELOG.md](../CHANGELOG.md).
|
in [CHANGELOG.md](../CHANGELOG.md).
|
||||||
|
|
||||||
|
Ready-to-paste block for the **1.1.2 update** (`versionCode` 7) — the foreground-service
|
||||||
|
fix (223 chars):
|
||||||
|
|
||||||
|
<en-US>
|
||||||
|
Fixed a crash that could happen right after starting or cancelling a scan.
|
||||||
|
|
||||||
|
• The scan notification now appears immediately, so a running scan keeps going while you use other apps
|
||||||
|
• Cancelling a scan no longer stops the app
|
||||||
|
</en-US>
|
||||||
|
|
||||||
|
Optional German block for the same update (252 chars):
|
||||||
|
|
||||||
|
<de-DE>
|
||||||
|
Ein Absturz direkt nach dem Starten oder Abbrechen eines Scans ist behoben.
|
||||||
|
|
||||||
|
• Die Scan-Benachrichtigung erscheint jetzt sofort, damit ein laufender Scan weiterläuft, während du andere Apps benutzt
|
||||||
|
• Das Abbrechen eines Scans beendet die App nicht mehr
|
||||||
|
</de-DE>
|
||||||
|
|
||||||
Ready-to-paste block for the **new freemium listing's first release** (313 chars):
|
Ready-to-paste block for the **new freemium listing's first release** (313 chars):
|
||||||
|
|
||||||
<en-US>
|
<en-US>
|
||||||
|
|||||||
+6
-5
@@ -31,8 +31,8 @@ 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, [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) step 5 carries all four things the form asks for (description, defer/interrupt impact, use case **Local processing: Other**, video link), and the **video now exists**: recorded on the test device on 2026-10-14 with `INSTALL=0 WARMUP=0 tools/record-fgs-demo.sh`, then verified frame by frame rather than assumed — intro at 0 s, the scan starting, **~6 s of the shade with the live "Finding duplicate photos / Looking for visually similar photos… / CANCEL" notification while the scan kept running**, and the results at the end. It is committed, and that is what published it — the link is the file's **page** in Gitea (`/src/branch/main/…`), which plays it anonymously. The `/raw/` URL is deliberately not the link: Gitea sends `Content-Security-Policy: default-src 'none'` with raw responses, so a browser navigating to the video sits on a blank tab even though the bytes are perfect. Pasting the page URL into the declaration is all that is left. Two details of the take are recorded in step 5 because they each cost an attempt: a *warm* scan is 5.4 s, shorter than the shade takes to open, so `WARMUP=0` films the cold one; and MIUI refuses `adb install` outright, so `INSTALL=0` records with the build already on the device. On a KVM-less emulator the same video cannot be made at all: every scan start dies as `am_crash … ForegroundServiceDidNotStartInTimeException` → *Force finishing activity* with no `am_kill`, i.e. emulation is too slow to reach `startForeground()` inside Android's budget (QEMU's `-icount` clock dilation made it work once, not reproducibly) |
|
| **Play Console: foreground-service declaration** | Declaring the `dataSync` type (App content › Foreground service permissions) is release-blocking. **[code]** the manifest already declares it, [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) step 5 carries all four things the form asks for (description, defer/interrupt impact, use case **Local processing: Other**, video link), and the **video now exists**: recorded on the test device on 2026-10-14 with `INSTALL=0 WARMUP=0 tools/record-fgs-demo.sh`, then verified frame by frame rather than assumed — intro at 0 s, the scan starting, **~6 s of the shade with the live "Finding duplicate photos / Looking for visually similar photos… / CANCEL" notification while the scan kept running**, and the results at the end. It is committed, and that is what published it — the link is the file's **page** in Gitea (`/src/branch/main/…`), which plays it anonymously. The `/raw/` URL is deliberately not the link: Gitea sends `Content-Security-Policy: default-src 'none'` with raw responses, so a browser navigating to the video sits on a blank tab even though the bytes are perfect. Pasting the page URL into the declaration is all that is left. Two details of the take are recorded in step 5 because they each cost an attempt: a *warm* scan is 5.4 s, shorter than the shade takes to open, so `WARMUP=0` films the cold one; and MIUI refuses `adb install` outright, so `INSTALL=0` records with the build already on the device. On a KVM-less emulator the same video cannot be made at all: every scan start dies as `am_crash … ForegroundServiceDidNotStartInTimeException` → *Force finishing activity* with no `am_kill`, i.e. emulation is too slow to reach `startForeground()` inside Android's budget (QEMU's `-icount` clock dilation made it work once, not reproducibly) |
|
||||||
| **Remaining Play paperwork** | Console actions only, no code: the **hosted privacy policy URL** (the working copy is now published to Gitea as [`fishfacegit/foto-duplicate-finder`](https://gitea.softwareapp-hb.de/fishfacegit/foto-duplicate-finder), so the policy renders at a public, login-free URL and only the Console paste is left), **Data safety**, the **Photo/video permissions** declaration, the **content rating / audience / app access / ads / advertising ID / export** questions, and the **listing copy + the three screenshot sets** (phone, 7-inch and 10-inch, all captured), plus the **freemium setup**: publish the new listing at `de.softwareapp_hb.fotodup.finder.free` as **Free**, create and activate the one-time product `pro_no_ads`, add the AdMob app/banner unit and UMP message, set `legacyPro.cutoffEpochMs` to the first freemium release, and update the **Ads / Advertising ID / Data Safety** answers ([MONETIZATION](MONETIZATION.md)). The old paid listing at `.finder` and its €2.99 price/sale are left untouched. Confirm **Play App Signing for the new app** (the same upload key can sign both listings). Keystore, `versionCode`, listing copy, graphics, permission audit and the signed `.aab` (the 1.0.2 `versionCode` 3 build is historical; the 1.1.0 validation build is in [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) step 3) are 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 **hosted privacy policy URL** (the working copy is now published to Gitea as [`fishfacegit/foto-duplicate-finder`](https://gitea.softwareapp-hb.de/fishfacegit/foto-duplicate-finder), so the policy renders at a public, login-free URL and only the Console paste is left), **Data safety**, the **Photo/video permissions** declaration, the **content rating / audience / app access / ads / advertising ID / export** questions, and the **listing copy + the three screenshot sets** (phone, 7-inch and 10-inch, all captured), plus the **freemium setup**: publish the new listing at `de.softwareapp_hb.fotodup.finder.free` as **Free**, create and activate the one-time product `pro_no_ads`, add the AdMob app/banner unit and UMP message, set `legacyPro.cutoffEpochMs` to the first freemium release, and update the **Ads / Advertising ID / Data Safety** answers ([MONETIZATION](MONETIZATION.md)). The old paid listing at `.finder` and its €2.99 price/sale are left untouched. Confirm **Play App Signing for the new app** (the same upload key can sign both listings). Keystore, `versionCode`, listing copy, graphics, permission audit and the signed `.aab` (the 1.0.2 `versionCode` 3 build is historical; the 1.1.1 validation build is in [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) step 3) are in place; rollout goes internal → closed → production. Step-by-step: [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) |
|
||||||
| ~~Store screenshots need one re-shoot~~ ✅ **done for the paid build — freemium re-shoot pending** | 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. **The freemium build additionally needs the banner and the Pro sheet in frame; re-shoot before the 1.1.0 listing.** Details: [STORE_LISTING](STORE_LISTING.md) |
|
| ~~Store screenshots need one re-shoot~~ ✅ **done for the paid build — freemium re-shoot pending** | 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. **The freemium build additionally needs the banner and the Pro sheet in frame; re-shoot before the 1.1.1 listing.** Details: [STORE_LISTING](STORE_LISTING.md) |
|
||||||
| ~~Tablet store screenshots outstanding~~ ✅ **done for the paid build — freemium re-shoot pending** | 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) |
|
| ~~Tablet store screenshots outstanding~~ ✅ **done for the paid build — freemium re-shoot pending** | 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 |
|
||||||
|
|
||||||
@@ -48,9 +48,10 @@ Legend: ✅ done · 🚧 in progress · ⏳ not started · 💡 candidate (propo
|
|||||||
## Suggested order
|
## Suggested order
|
||||||
|
|
||||||
1. ✅ **Done** — the scan-stall hardening and the `BoundedCall` fix shipped as **1.0.1**
|
1. ✅ **Done** — the scan-stall hardening and the `BoundedCall` fix shipped as **1.0.1**
|
||||||
(`versionCode` 2); **1.0.2** (`versionCode` 3) was the last paid build. The next upload is
|
(`versionCode` 2); **1.0.2** (`versionCode` 3) was the last paid build. The freemium
|
||||||
**1.1.0** (`versionCode` 4), the freemium build, which also needs the Play Console changes in
|
listing went out as **1.1.1** (`versionCode` 6); the current upload is **1.1.2**
|
||||||
[MONETIZATION](MONETIZATION.md). Only the on-device re-check of the 5,363-photo scan remains.
|
(`versionCode` 7), the `ForegroundServiceDidNotStartInTime` fix, which still needs the
|
||||||
|
Play Console changes in [MONETIZATION](MONETIZATION.md).
|
||||||
2. Finish the Play Console paperwork and roll out through **internal → closed → production**.
|
2. Finish the Play Console paperwork and roll out through **internal → closed → production**.
|
||||||
3. ✅ **Done** — **M10 store assets**: the icon and feature graphic are generated from the
|
3. ✅ **Done** — **M10 store assets**: the icon and feature graphic are generated from the
|
||||||
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
|
||||||
|
|||||||
+14
-2
@@ -178,7 +178,7 @@ sequenceDiagram
|
|||||||
SE-->>SC: ScanProgress.Finished(ScanResult)
|
SE-->>SC: ScanProgress.Finished(ScanResult)
|
||||||
SC-->>VM: StateFlow<ScanState>
|
SC-->>VM: StateFlow<ScanState>
|
||||||
VM-->>UI: groups, summary, selection
|
VM-->>UI: groups, summary, selection
|
||||||
SC->>SVC: stop foreground service
|
SVC->>SVC: sees "not scanning" and stops itself
|
||||||
```
|
```
|
||||||
|
|
||||||
### Phases
|
### Phases
|
||||||
@@ -196,6 +196,16 @@ keeps going when the app is backgrounded because `ScanService` holds a `dataSync
|
|||||||
foreground service for the duration. The ViewModel only mirrors progress; it never
|
foreground service for the duration. The ViewModel only mirrors progress; it never
|
||||||
owns the scan.
|
owns the scan.
|
||||||
|
|
||||||
|
`ScanService` enters the foreground in `onCreate()` *and* at the top of every
|
||||||
|
`onStartCommand()`, before any early return. `startForegroundService()` obliges the
|
||||||
|
service to call `startForeground()` within a few seconds, and a start that is
|
||||||
|
cancelled (notification Cancel, in-app Cancel) or already finished is still a start.
|
||||||
|
For the same reason nothing outside the service calls `stopService()`: an external
|
||||||
|
stop can land while the start is still queued on the main thread, which leaves
|
||||||
|
`startForeground()` un-called and surfaces as
|
||||||
|
`RemoteServiceException.ForegroundServiceDidNotStartInTimeException`. The service
|
||||||
|
stops itself as soon as it observes `ScanState.scanning == false`.
|
||||||
|
|
||||||
Three failure boundaries matter:
|
Three failure boundaries matter:
|
||||||
|
|
||||||
- `BoundedCall` gives every provider call a deadline, so one wedged file cannot
|
- `BoundedCall` gives every provider call a deadline, so one wedged file cannot
|
||||||
@@ -472,7 +482,9 @@ Paths are relative to `app/src/main/java/de/softwareapp_hb/fotodup/finder/` unle
|
|||||||
`BannerAdSlot` owns the `AdView` lifecycle and requests exactly one banner.
|
`BannerAdSlot` owns the `AdView` lifecycle and requests exactly one banner.
|
||||||
- **MediaDeleter** owns the system consent request. No other class may delete a
|
- **MediaDeleter** owns the system consent request. No other class may delete a
|
||||||
photo or bypass the two-step staging flow.
|
photo or bypass the two-step staging flow.
|
||||||
- **ScanService** mirrors `ScanController`; it contains no scanning logic.
|
- **ScanService** mirrors `ScanController`; it contains no scanning logic. It owns the
|
||||||
|
foreground contract (enter the foreground in `onCreate`, stop itself when idle) and
|
||||||
|
is never stopped from outside.
|
||||||
- **core/** stays pure Kotlin. A new Android import there is an architecture bug.
|
- **core/** stays pure Kotlin. A new Android import there is an architecture bug.
|
||||||
|
|
||||||
## 11. Keeping the map accurate
|
## 11. Keeping the map accurate
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
# Then enable Play App Signing in the Play Console and register this key as the
|
# Then enable Play App Signing in the Play Console and register this key as the
|
||||||
# *upload* key (Google keeps the app signing key).
|
# *upload* key (Google keeps the app signing key).
|
||||||
|
|
||||||
# Path to your keystore (absolute is safest).
|
# Path to your keystore (absolute is safest). On the dev machine the upload
|
||||||
|
# keystore (shared with the paid listing) lives in /home/ubuntu/keystore/.
|
||||||
storeFile=/absolute/path/to/fotodup-upload.jks
|
storeFile=/absolute/path/to/fotodup-upload.jks
|
||||||
storePassword=change-me
|
storePassword=change-me
|
||||||
keyAlias=upload
|
keyAlias=upload
|
||||||
|
|||||||
Reference in New Issue
Block a user