# Guides

Recurring procedures. The reasons behind them are in [decisions.md](decisions.md).

## Which file serves which devices

| File | Read by | Devices |
|---|---|---|
| `Numero2.json` | Store-App | Ordissimo Numero2 phones |
| `Numero2Mini.json` | Store-App, DPC (default profile) | Numero2 Mini, other Ordissimo models without a file, and non-Ordissimo phones with a Store older than 1.3.6 |
| `Celia.json` | Store-App | Celia tablets |
| `PixstarTouch.json` | Store-App | Pix-Star Touch |
| `Orange.json` | Store-App | builds of the `orange` flavor |
| `ExclusiveMobile.json` | Store-App from 1.3.6, DPC (`profile_url` of the QR code), club app | non-Ordissimo phones (Exclusive Mobile) |
| `DebugOrdissimo.json` | Store-App in developer mode | test devices; written by Codemagic |
| `DebugOrange.json` | Store-App in developer mode | test devices; edited by hand |
| `DebugOld.json` | older Store-App versions in developer mode | test devices; kept identical to `DebugOrdissimo.json` |

Store-App picks the file in `Android-Apps-Root/Store-App/.../StoreTypeRepository.kt`: by flavor, then by device model. A `Debug*` file is read only when developer mode is on and that store is selected in the Store preferences. Adding a file for Store-App therefore needs a Store-App release; a new DPC profile only needs a new QR code.

## Factory state of the devices

What a device has after a factory reset, before any Store update (read with `adb shell dumpsys package <package>` on 2026-10-28). An app installed at the factory is updated by the Store; an app missing here is a first install, which Play Protect blocks when the APK targets an old Android ("Unsafe app blocked", see [decisions.md](decisions.md#31-pix-star-touch-offers-anydesk-only--active-2026-10-28)).

| App (`versionName` / `versionCode`) | Celia (Android 10) | Pix-Star Touch (Android 11) | Numero2 (Android 10) | Numero2 Mini (Android 13) |
|---|---|---|---|---|
| Launcher (tablet or phone) | 1.0.0 / 46 | 1.0.5 / 61 | 9.0.1 / 229 | 9.1.7 / 281 |
| Dialer | – | – | 1.2.1 / 51 (key B) | 1.4.3 / 84 |
| Contacts | 1.0.0 / 21 | 1.0.3 / 38 | – | 1.1.4 / 49 |
| Gallery | 1.0.0 / 25 | 1.0.6 / 37 | – | 1.1.3 / 43 |
| Browser | 1.0.0-l / 1 | 1.0.5 / 432 | – | 1.0.0 / 1 |
| Mail | 1.0.1 / 10001 | 5.9142 / 290142 | – | – |
| Store | 1.0.4 / 24 | 1.0.0 / 41 | 1.0.0 / 10 | 1.1.6 / 48 |
| TeamViewer QuickSupport | 15.8.115 / 158115 | – | 15.4.61 / 154061 | – |
| AnyDesk | – | 6.1.12 / 60112 | – | 7.0.0 / 70000 |
| AnyDesk add-on AD1 | – | 1.0.16 / 10016 | – | 1.1.4 / 10104 |
| Wishtel add-ons (TeamViewer, AnyDesk) | – | – | – | – |

- Ordissimo apps are signed with key A, except the Numero2 Dialer (key B: the Store gives it the `_rotated` APK). Celia and Numero2 apps are in `/system/app`, Pix-Star Touch and Numero2 Mini apps in `/product/priv-app` and `/system/priv-app`.
- The Numero2 Mini AnyDesk 7.0.0 is re-signed by the manufacturer, not by AnyDesk: the Store can never update it, and it is newer than the AnyDesk of the JSON files, so the Store shows it as installed. It works for remote support with the factory AD1.
- The Wishtel add-ons are signed with the Celia platform key: they work only on Celia, and are a first install there.
- Store versions older than 48 (factory Celia, Pix-Star Touch and Numero2) read the legacy catalogue `http://android.ordissimo.com/store/store.json`, which is only on the server, and have no "Tout télécharger" button: the customer updates the apps one by one, the Store last. Store 48 then reads the file of the model, so a device goes through two rounds of updates. Apps missing at the factory are offered as first installs (Internet and Mail on a Numero2).

## Entry format

```json
{
  "version": 1,
  "message": "Bonjour",
  "apps": [
    {
      "package": "com.ordissimo.android.dialer",
      "icon": "http://android.ordissimo.com/store/icons/launcher_ic_dialer.png",
      "versionCode": 90,
      "versionName": "1.4.9",
      "minSdkVersion": 23,
      "maxSdkVersion": 99,
      "autoInstall": true,
      "details": { "fr": { "label": "…", "description": "…" }, "en": { "label": "…", "description": "" } },
      "apks": {
        "armeabi-v7a": { "url": "http://…/Dialer-App-release-v90.apk", "md5": "…" },
        "arm64-v8a":   { "url": "http://…/Dialer-App-release-v90.apk", "md5": "…" }
      },
      "devices": ["phone"]
    }
  ]
}
```

- `apks` has one entry per ABI; most apps use the same universal APK for both. An entry may add `splits` (extra APKs installed together, such as density configuration splits).
- `devices`: `phone`, `tablet` or both. One package may appear twice with different `devices` (Mail has a phone and a tablet APK).
- `autoInstall: true`: installed without asking the user.
- The rules checked are in `validate_store.py`.

## Publish an APK by hand

Codemagic does it for the `Debug*` files (`ci-deploy-store.sh` in each app of `Android-Apps-Root`). By hand:

1. Copy the APK to `/var/www/html/store/apk/<flavor>/` on the server, with read rights for the web server.
2. Check the published file, following the http → https redirect (without `-L`, curl saves the 169-byte redirect page):
   ```bash
   curl -sSfLo /tmp/check.apk http://android.ordissimo.com/store/apk/ordissimo/<file>.apk && md5sum /tmp/check.apk
   ```
3. Put that MD5 in the JSON (next sections), validate and prepare the commit; the maintainer approves it, pushes and pulls on the server.

## Pull on the server

`/var/www/html/json` is a git clone; run `git pull origin main` there after every push. The automatic pull of `ci-deploy-store.sh` currently fails (see [decisions.md](decisions.md#open-items-updated-2026-10-21)), so pull by hand after a Codemagic build too.

## Update a production file from the tested versions

Copy `versionCode`, `versionName` and `apks` from `DebugOrdissimo.json` for chosen packages, keeping the other fields (labels, `autoInstall`, `devices`) of the production entry:

```bash
jq --indent 2 --slurpfile d DebugOrdissimo.json '
  .apps |= map(. as $a
    | if ($a.package | IN("com.ordissimo.android.launcher", "com.ordissimo.android.contacts")) then
        ([$d[0].apps[] | select(.package == $a.package)] | first) as $n
        | .versionCode = $n.versionCode | .versionName = $n.versionName | .apks = $n.apks
      else . end)' Numero2.json > Numero2.json.new && mv Numero2.json.new Numero2.json
git diff -U0 | grep '^[-+] '
python3 validate_store.py Numero2.json --check-urls
```

- For a package listed twice (Mail phone and tablet), also match on `devices`.
- Release together the apps that depend on each other: since version 295, the phone launcher protects its preferences with a signature permission, so a Dialer signed with another key crashes at launch.
- On Numero2, the Dialer entry must then be switched to the `_rotated` APK (next section).

## Numero2 Dialer

Numero2 phones ship a system Dialer signed with the legacy key: they refuse the normal Dialer APK. Each Dialer release for Numero2 is the release APK re-signed with a key rotation (why: [decisions.md](decisions.md#22-numero2-dialer-signed-with-a-key-rotation--active-2026-10-21)). In the `Android-Apps-Root` repository, `Dialer-App/scripts/rotate-dialer.sh <apk> [--install]` does it with the right keys and options (procedure: its `docs/guides.md`, "Release the Dialer for Numero2"). What it runs:

```bash
apksigner rotate --out lineage --old-signer <legacy key options> --new-signer <current key options>
apksigner sign <legacy key options> --next-signer <current key options> --lineage lineage \
  --rotation-min-sdk-version 28 --out Dialer-App-release-v<N>_rotated.apk Dialer-App-release-v<N>.apk
apksigner verify -v --print-certs Dialer-App-release-v<N>_rotated.apk
```

`<… key options>` are `--ks <keystore> --ks-key-alias <alias> --ks-pass file:<file> --key-pass file:<file>`: pass passwords through files, never on the command line. The two keystores are not in this repository (they are in `Android-Apps-Root/Dialer-App/app/keystore*/`).

Then publish it as above and point the Dialer entry of `Numero2.json` (and of the debug file used to test it) to it. Test on a Numero2 before: install with `adb install -r`, open the Dialer and the call history.

## Committing

- One commit per file or topic, message in English prefixed with the file, then a verb in the imperative (`Numero2: update Launcher 300 …`).
- `git pull` first: Codemagic pushes to `main` at each build.
- Never commit or push without the maintainer's approval, asked on one screen of multiple-choice questions whose first choice takes the whole chain (rule in [AGENTS.md](../AGENTS.md)). Before pushing, `git pull --rebase --autostash`. After the push, the maintainer pulls on the server.

## Data outside the repository

Ask the maintainer: the APKs (only on the server), the signing keystores and their passwords, the server access (`webssh`, port 8422) and the Codemagic secrets.
