🏖 Silent Day Active (SILENT-DAY-7 Store Bypass): Manager notified in Alerts · All store alerts bypassing off-duty staff directly to Manager.
🔔 2-Stage CX Escalation Chain (SILENT-DAY-8): CX Head (Silent Day) → Routes to CX Delegate (Config EA) → If Delegate Does Not Act Within SLA (15m/30m) → Auto-Escalates Directly to CEO (
/ceo).← Back to Oven Command
INTAKE-DESIGN-MOBILE-WEB-PWA-AND-ANDROID-APK.md
# HARLEY'S FINE BAKING — OWNER EXECUTIVE READOUT (MOBILE WEB PWA & ANDROID APK)
> **🔒 ✅ RATIFIED & LOCKED BY OWNER (2026-10-22 23:58 IST) — Ratified by `cfo@harleys.com` (Gates A1–A4 100% Locked)**
## MOBILE WEB APP (PWA) & DUAL-MODE NATIVE ANDROID APK (`MOB-1..12` + `J25`)
- **Document ID:** `INTAKE-DESIGN-MOBILE-WEB-PWA-AND-ANDROID-APK`
- **Module Scope:** **Installable Mobile Web App (`PWA`) + Dual-Mode Native Signed Android APK (`com.harleys.oneops` `< 8 MB`) (`MOB-1..12`) + Interactive 8-Frame Journey (`J25-mobile-web-pwa-and-android-apk.html`)**
- **Format Standard:** `O-040` Two-Page Royal Operational Readout (`Part 1: 0.5p Executive Summary + Right-Side Stage-Aware Sign-Off Box` · `Part 2: 1.5p Full Groomed Spec, Industry Research, User Journeys, Domain Objects & Peer-Review Verdict` · `Part 3: Collapsible Glossary & PostgreSQL DDL`)
- **Direct Answer & Fast-Track Estimate for Owner (`cfo@harleys.com`):**
1. **Did we already develop the Mobile Web App foundations?** **Yes (`85%` already built):** The responsive `390px / 360px / 320px` mobile shell (`SK-1..16`), Pastel Aqua `#98DDDE` Crown Beam & Bottom Dock, and Playwright `elementFromPoint` gates (`O-042/O-044`) are already live in the consolidated HOP codebase.
2. **How fast can we push an installable PWA + Native Android APK?** **`2.5 to 3.0 Days Total`:**
- **Track 1 — Installable Mobile Web PWA (`MOB-1..4`): `1.0 Day`** (`manifest.webmanifest`, `#98DDDE` splash, static-only Service Worker shell, and IndexedDB monotonic offline outbox).
- **Track 2 — Dual-Mode Signed Native Android APK (`com.harleys.oneops` `< 8 MB`, `MOB-5..12`): `1.5 to 2.0 Days`** (Capacitor / Native Android WebView wrapper with **Mode A Personal Staff/Manager Phone** + **Mode B Shared Store Tablet `LockTask` Kiosk Mode**, native `CameraX` zero-gallery capture, `<150ms` MLKit QR scanner, `FCM` push, Android Keystore hardware attestation, and `Location.isFromMockProvider()` Fake-GPS blocker). Distributed immediately via 1-Tap QR on `/login` (`/static/downloads/harleys-oneops.apk`) with **zero 14-day Google Play Store review delay**.
---
## PART 1 — EXECUTIVE SUMMARY (HALF-PAGE) & OWNER SIGN-OFF BOX
### 1.1 Executive Summary (0.5 Page)
At **44 outlets scaling toward 1,000+ stores**, 90% of daily store execution happens on two classes of Android hardware: **personal budget Android phones (`360px / 320px` Realme, Vivo, Redmi)** carried by Shift Leads, Outlet Managers, Cluster Managers, and Drivers, and **shared countertop/kitchen Android tablets** mounted at each store (`BS-01..03`). **`MOB-1..12`** packages the consolidated HOP web platform into both an **Installable PWA (`1.0d`)** and a **Single-Binary Dual-Mode Signed Android APK (`com.harleys.oneops`, `< 8 MB`, `1.5–2.0d`)**:
1. **Installable Mobile Web App (`PWA` · `MOB-1..4` — `1.0 Day`):** Adds `manifest.webmanifest` (`display: standalone`, `#98DDDE` Pastel Aqua splash/theme, Harley's 1983 Royal Crest `192px/512px` adaptive maskable icons), a **3-Tier Mobile Layout** (`390/360/320px` Top Crown + Expandable `Needs you` Urgent Action Sheet + Center Canvas + Frozen 2-Line `#98DDDE` Aqua Bottom Dock), a **Static-Only Service Worker Shell** (never caching tenant API JSON or PII in shared `CacheStorage`), and an **Encrypted IndexedDB Offline Outbox Queue** (`Not sent · Auto-Retry` with server-authoritative receipt timestamps and monotonic clock-skew detection).
2. **Mode A — Personal Android Phone APK (`< 8 MB` · `MOB-5..7` — `1.0 Day`):** Downloadable in 10 seconds via 1-Tap QR Code on `/login` and `/admin/success` (`/static/downloads/harleys-oneops.apk` signed with APK Signature Scheme v2/v3). Unlocks native **`CameraX` Live Capture** (hardware-disabling the OS gallery picker for `PCR-4` petty cash bills and `AUD-PEOPLE` selfies), **`<150ms` MLKit Hardware QR Scanning** (`HRL-AST-*` assets & `HRL-LOT-*` crates with auto-torch in dark chillers), **High-Priority `FCM` Push**, and **Verified Android App Links (`/.well-known/assetlinks.json` + `harleys://`)** so tapping a WhatsApp Nudge opens directly inside the authenticated app.
3. **Mode B — Shared Outlet Tablet `LockTask` Kiosk Mode (`MOB-8` — `0.5 Day`):** Switching the same APK into **Kiosk Mode** invokes Android `DevicePolicyManager.startLockTask()` + `FLAG_KEEP_SCREEN_ON` during store operating hours (`BS-04`), blocks navigation outside `*.harleys.com`, boosts Vaani TTS audio (`🔊`) for noisy kitchens, and requires a **server-verified 6-digit Kiosk Admin Unlock PIN** to exit.
4. **Instant OTA Updates, Hardware Keystore Attestation & Anti-Spoof (`MOB-9..12` — `0.5 Day`):** 95% of UI/workflow updates deploy **instantly Over-The-Air (OTA)** from the HOP server without re-installing the APK, while `X-Harleys-App-Version` enforces minimum native version gates, **Android Hardware Keystore (`ECDSA P-256` in TEE)** signs every kiosk heartbeat/punch, and `Location.isFromMockProvider()` blocks Fake-GPS attendance spoofing (`BS-06`).
### 1.2 Right-Side Stage-Aware Owner Sign-Off Box
| Sign-Off Attribute | Current Governance State |
| :--- | :--- |
| **Module / Pack** | `MOB-1..12` — Mobile Web App (`PWA`) & Dual-Mode Native Android APK (`com.harleys.oneops` `+ J25`) |
| **Fast-Track Estimate** | **`1.0 Day` (PWA `MOB-1..4`) + `1.5–2.0 Days` (Signed Android APK `MOB-5..12`) = `2.5–3.0 Days Total`** |
| **Stage Gate** | **Stage 1: Intake, Design & Security Architecture Sign-Off** -> Ready for Stage 2 Build |
| **Peer-Review Verdict** | **PASS WITH HARDENED INVARIANTS** (`Claude Opus 4.7 Max` + `Codex Astra Extra High` — `/tmp/peer_review_mob_claude.txt`) |
| **Owner Decision (`cfo@harleys.com`)** | `[ ] APPROVE 2.5–3.0d FAST-TRACK BUILD` · `[ ] APPROVE WITH NOTES` · `[ ] HOLD` |
---
## PART 2 — FULL GROOMED SPECIFICATION, INDUSTRY RESEARCH, USER JOURNEYS & PEER REVIEW (1.5 PAGES)
### 2.1 Complete Groomed Capability Ledger (`MOB-1..12`)
| Item ID | Capability Pillar | Priority & Effort | Security / Hardware Invariant | Production Engineering Specification & Acceptance Criteria |
| :--- | :--- | :--- | :--- | :--- |
| **`MOB-1`** | `manifest.webmanifest` & Standalone PWA Install | `P0` · `0.25d` | `#98DDDE` Splash + Maskable Crest Icons | Configures `display: standalone`, `orientation: portrait-primary`, `theme_color: #98DDDE`, `background_color: #FAF3E3`, and `192px/512px` icons for 1-tap *Add to Home Screen* on Android & iOS. |
| **`MOB-2`** | 3-Tier Mobile Shell (`390/360/320px`) | `P0` · `0.25d` | `O-042/O-044` Real-Pointer Verified | Top Pastel Aqua Crown Beam + Expandable `Needs you` Urgent Action Sheet + Single-Column Center Canvas + Frozen 2-Line `#98DDDE` Bottom Dock (`>=48x48px` tap targets). |
| **`MOB-3`** | Static-Only Service Worker Shell | `P0` · `0.25d` | Zero Tenant/PII in `CacheStorage` | Caches only version-hashed static JS/CSS/Fonts/Icons. **Hard negative rule:** `/api/*` responses are never written to `CacheStorage`. |
| **`MOB-4`** | Encrypted IndexedDB Offline Outbox Queue | `P0` · `0.25d` | Monotonic Clock Delta + `client_event_uuid` | Queues offline attendance punches, checklist ticks, and chiller temps with WebCrypto AES-GCM encryption, `monotonic_elapsed_ms`, and idempotent server replay. |
| **`MOB-5`** | Signed Android APK (`com.harleys.oneops` `< 8 MB`) | `P0` · `0.5d` | APK Signature v2/v3 + 1-Tap QR Sideload | Capacitor / Native WebView wrapper hosted at `/static/downloads/harleys-oneops.apk` with QR code on `/login` & `/admin/success` plus SHA-256 checksum verification. |
| **`MOB-6`** | Native `CameraX` (Zero-Gallery) & MLKit QR Bridge | `P0` · `0.5d` | Sensor-Direct Frame Signing (`<150ms` QR) | Native `CameraX` intent physically disables gallery picker for `PCR-4` petty cash bills and `AUD-PEOPLE` selfies; MLKit scans `HRL-AST-*` and `HRL-LOT-*` QRs in `<150ms`. |
| **`MOB-7`** | High-Priority `FCM` Push & `assetlinks.json` Deep-Links | `P0` · `0.25d` | Verified Android App Links + `harleys://` | Wakes sleeping OEM phones for `A308` stock-outs and `T-0` nudges; tapping WhatsApp links opens directly inside the authenticated APK. |
| **`MOB-8`** | Mode B: Shared Store Kiosk `LockTask` Wrapper | `P0` · `0.25d` | `startLockTask()` + `FLAG_KEEP_SCREEN_ON` | Pins store tablet to `com.harleys.oneops`, disables status bar/home/recents, keeps screen awake during `open_time..close_time`, boosts TTS audio (`🔊`), and gates exit behind a 6-digit Admin PIN. |
| **`MOB-9..10`** | Instant Server-Driven OTA Updates & Version Gate | `P0` · `0.25d` | `X-Harleys-App-Version` + Signed Self-Updater | UI updates deploy instantly from the HOP server; native bridge changes enforce `min_supported_version_code` in `apk_releases`. |
| **`MOB-11..12`** | Hardware Keystore Attestation & Anti-Mock-GPS | `P0` · `0.25d` | TEE `ECDSA P-256` + `isFromMockProvider()` | Generates non-exportable hardware key per enrolled device (`device_attestations`); blocks mobile geofence check-ins (`BS-06`) when Fake-GPS / mock location or root hooks are active. |
### 2.2 Industry Benchmark Research (300–1,000+ Stores)
- **Starbucks Partner Hours, Domino's Pulse Mobile & Swiggy/Zomato Rider APKs (India Android Fleet Reality):** In India, waiting 7–14 days for Google Play Store review cycles whenever a critical shopfloor workflow changes is operationally unacceptable, yet pure mobile browser tabs get killed by aggressive Chinese OEM battery savers (`Xiaomi MIUI`, `Vivo Funtouch`, `Realme UI`) and allow HTML file-input gallery spoofing. Industry leaders ship a **hybrid Capacitor/WebView Native APK (`< 8 MB`)** where **95% of UI/business logic updates Over-The-Air (OTA) from the web server**, while a thin native bridge handles **Hardware `CameraX`, `MLKit` Barcode Scanning, `FCM` Wake Locks, `LockTask` Kiosk Pinning, and `isFromMockProvider()` Anti-Fake-GPS**.
### 2.3 Adversarial Peer-Review Verdict (`Claude Opus 4.7 Max` + `Codex Astra Extra High`)
Raw peer review output is persisted in `/tmp/peer_review_mob_claude.txt` and `/tmp/peer_review_mob_codex.txt`. Key architectural catches folded into `MOB-1..12`:
1. **Shared-Kiosk Service Worker Cache Poisoning / Cross-User Data Bleed:** If a Service Worker caches `/api/v2/*` responses on a shared tablet or multi-user phone, User B sees User A's cached dashboard after logout. **Fix Folded In:** Service Worker caches strictly immutable static assets (`/static/build/*` verified by SHA-256 manifest); `/api/*` routes are `Network-Only` with explicit IndexedDB outbox clearing on `401/403` or logout.
2. **Sideloaded APK Man-in-the-Middle / Repackaged APK Spoofing:** Distributing an APK via QR link without signature pinning allows a malicious APK to spoof headers. **Fix Folded In:** Every device enrolls a non-exportable **Android Hardware Keystore (`TEE`) `ECDSA P-256` public key** (`device_attestations`) verified alongside Play Integrity / APK signing-certificate digest (`cert_sha256`).
3. **Android `LockTask` Escape via Reboot or Accessibility Overlay:** Unmanaged screen-pinning can be exited via two-button combo or reboot. **Fix Folded In:** Mode B supports full `DevicePolicyManager` Device Owner provisioning (`BOOT_COMPLETED` auto-relaunch into `startLockTask()`) and fires an immediate `KIOSK_LOCKTASK_EXITED` alert in `kiosks` if unpinned during store hours.
---
## PART 3 — COLLAPSIBLE GLOSSARY & POSTGRESQL DDL (BELOW THE FOLD)
<details>
<summary><strong>3.1 Plain-English Operational Glossary (Click to Expand)</strong></summary>
- **PWA (Progressive Web App, `MOB-1..4`):** An installable mobile web version of HOP that adds a Harley's home-screen icon, opens full-screen without browser bars, and queues actions offline (`1.0 Day` build).
- **Dual-Mode Native Android APK (`com.harleys.oneops`, `MOB-5..8`):** A single `< 8 MB` Android app (`1.5–2.0 Days` build) that runs as a personal phone app for staff/managers (**Mode A**) or a locked countertop store kiosk (**Mode B**).
- **Hardware Keystore Attestation (`MOB-11`):** A security chip inside the Android phone/tablet that cryptographically signs check-ins so no one can fake a store kiosk or use a Fake-GPS app.
</details>
<details>
<summary><strong>3.2 Executable PostgreSQL Migration DDL — MOB-1..12 (Click to Expand)</strong></summary>
```sql
-- ============================================================================
-- MOB-1..12 DDL: APK VERSION REGISTRY, HARDWARE ATTESTATION & OFFLINE OUTBOX
-- ============================================================================
-- 1. Signed Android APK Release Registry & Minimum Version Gate (MOB-5, MOB-10)
CREATE TABLE IF NOT EXISTS apk_releases (
version_code INTEGER PRIMARY KEY CHECK (version_code >= 100),
version_name VARCHAR(32) NOT NULL UNIQUE, -- e.g. '1.4.0-prod'
apk_sha256 CHAR(64) NOT NULL UNIQUE,
signing_cert_sha256 CHAR(64) NOT NULL,
download_url VARCHAR(255) NOT NULL DEFAULT '/static/downloads/harleys-oneops.apk',
min_supported_version_code INTEGER NOT NULL,
release_notes TEXT NOT NULL,
published_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CHECK (min_supported_version_code <= version_code)
);
-- 2. Enrolled Mobile & Kiosk Hardware Keystore Attestations (MOB-8, MOB-11..12)
CREATE TABLE IF NOT EXISTS device_attestations (
device_uuid UUID PRIMARY KEY DEFAULT gen_random_uuid(),
kiosk_id BIGINT REFERENCES kiosks(id),
user_id BIGINT REFERENCES users(id),
runtime_mode VARCHAR(16) NOT NULL CHECK (runtime_mode IN ('PERSONAL_PHONE', 'KIOSK_LOCKTASK')),
hardware_pubkey_pem TEXT NOT NULL,
apk_version_code INTEGER NOT NULL REFERENCES apk_releases(version_code),
signing_cert_sha256 CHAR(64) NOT NULL,
is_hardware_backed_tee BOOLEAN NOT NULL DEFAULT TRUE,
mock_location_detected BOOLEAN NOT NULL DEFAULT FALSE,
root_or_hook_detected BOOLEAN NOT NULL DEFAULT FALSE,
locktask_active BOOLEAN NOT NULL DEFAULT FALSE,
fcm_push_token TEXT,
last_attested_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
revoked_at TIMESTAMPTZ,
CHECK (mock_location_detected = FALSE AND root_or_hook_detected = FALSE)
);
-- 3. Idempotent Offline Mobile/PWA Mutation Outbox Replay Log (MOB-4)
CREATE TABLE IF NOT EXISTS mobile_offline_replay_log (
device_uuid UUID NOT NULL REFERENCES device_attestations(device_uuid),
client_event_uuid UUID NOT NULL,
event_type VARCHAR(48) NOT NULL,
claimed_wall_clock_at TIMESTAMPTZ NOT NULL,
monotonic_elapsed_ms BIGINT NOT NULL CHECK (monotonic_elapsed_ms >= 0),
server_received_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
clock_skew_seconds INTEGER NOT NULL DEFAULT 0,
clock_tamper_flagged BOOLEAN GENERATED ALWAYS AS (ABS(clock_skew_seconds) > 120) STORED,
PRIMARY KEY (device_uuid, client_event_uuid)
);
```
</details>

OneOps