Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c90d6aa
App: Get mods and Updates in the Mods tab
AwsomeFox Nov 26, 2026
aaeba1b
Merge branch 'catalog/engine' into catalog/app
AwsomeFox Nov 27, 2026
91b7f3d
Merge branch 'catalog/engine' into catalog/app
AwsomeFox Nov 27, 2026
5efc552
App: per-mod "Install anyway", Update all per mod, a second OK, notes
AwsomeFox Nov 27, 2026
4aab3ad
Merge branch 'catalog/engine' into catalog/app
AwsomeFox Nov 27, 2026
34b9624
Installer: keep the engine's HTTPS library before /system changes
AwsomeFox Nov 27, 2026
8d7a2e3
Merge branch 'fix-423' into fix-424
AwsomeFox Nov 28, 2026
8391e69
App: Catalogue and Updates are tabs, next to Mods, Settings and Car R…
AwsomeFox Nov 28, 2026
f3063fe
App: every kind of update in the Updates tab; Mods is Installed mods
AwsomeFox Nov 28, 2026
d1aa440
Merge branch 'rel-engine' into tabs-424
AwsomeFox Nov 28, 2026
44c4ded
App: updates from mods' own releases, where each mod's updates come f…
AwsomeFox Nov 28, 2026
ae9f9bc
Merge branch 'rel-engine' into tabs-424
AwsomeFox Nov 28, 2026
59e99ad
Merge branch 'rel-engine' into tabs-424
AwsomeFox Nov 28, 2026
a4cf273
Merge remote-tracking branch 'origin/catalog/engine' into tabs-424
AwsomeFox Nov 29, 2026
69209bb
App: say "mod zip", not "package" (NEMESIS has packages)
AwsomeFox Nov 29, 2026
cc72da3
Merge catalog/engine (#423)
AwsomeFox Nov 30, 2026
b7ce7d0
Merge catalog/engine (now with release/2.0) into catalog/app
AwsomeFox Dec 2, 2026
b404e59
Merge catalog/engine into catalog/app (catalog-test fake release)
AwsomeFox Dec 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

- **Get mods: HMG-API's catalogue on the head unit.** Mods tab → Get mods lists `catalog/`
(each mod's own GitHub release, pinned by SHA-256 and author key) with what installing it
would do here; Install downloads it over home Wi-Fi and installs it. No server of our own:
the catalogue comes from `catalog/index.json` when there is one (`tools/catalog.py index`),
else from GitHub's listing of the folder. Engine: `catalog`, `catalog-plan`, `catalog-install`.
- **Dependencies are installed with a mod.** A mod's `requires` (copied into its catalogue
entry by `catalog.py add`, and read again from the downloaded zip's `mod.json`) are met
by what's installed, or by the catalogue's version, installed first; a required mod that's
Expand All @@ -20,6 +25,22 @@
installed or turned on, signed with the installed key) into `/data/hmgapi/pending/`, which
nothing loads; `engine apply` puts them in place first and keeps the previous version in
`/data/hmgapi/previous/`.
- **Updates.** Mods tab → Updates (with how many) lists installed mods with a newer catalogue
version, and a newer HMG-API release (on a pre-release, only that version's next ones), with
its release notes, Update and Update all (each mod that can go; the ones that can't are listed
with why). "Install anyway" is per mod and says for what: not listed for this head unit, or an
author who isn't on the trusted list. A mod's row in the list says "update x.y.z". HMG-API checks by itself each time
home Wi-Fi comes up, at most every 6 hours (owner switch `no_update_check` turns that off), and
can also download and stage the mods' plain updates then (`auto_stage_updates`, off by
default): they wait aside until the owner applies.
HMG-API itself only updates on the owner's tap: its update zip is checked against its
release's `SHA256SUMS`, then against the release key as from a USB stick. Engine: `updates`,
`update <id>... | --all | hmgapi`, `update-check`; `logs/hmgapi/updates.log`.
- **HMG-API's own HTTPS** (`/data/hmgapi/lib/libhmgapi_fetch.so`, `core/fetch`): Android 4.4's
Java TLS can't reach GitHub, so the engine uses the unit's own `libssl.so` (TLS 1.2), on a
socket marked for home Wi-Fi only, with its own DNS lookup on home Wi-Fi's server. Tested
first as a mod on an Ioniq 5 US 260507 (HMG-API rc.10): the catalogue and three packages
over home Wi-Fi, each with its SHA-256.
- **Home Wi-Fi joins on cars whose Wi-Fi library checks a checksum** (Ioniq 5 US 260507). The
stock library starts the car's Wi-Fi client only if `wpa_supplicant_crc32.conf` holds the
CRC-32 of `wpa_supplicant.conf`; HMG-API's saved networks didn't update it, so the client
Expand Down
339 changes: 339 additions & 0 deletions core/app/java/hmgapi/app/CatalogFlow.java

Large diffs are not rendered by default.

158 changes: 158 additions & 0 deletions core/app/java/hmgapi/app/CatalogTab.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
package hmgapi.app;

import android.app.AlertDialog;
import android.graphics.Color;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.Arrays;

/**
* Get mods: HMG-API's mod catalogue (engine catalog, kept from the last check; "Check now"
* fetches it again over home Wi-Fi). Each mod with what installing it would do here; Install
* takes the mods it requires too (CatalogFlow), then offers to apply. A tab of the main screen.
*/
final class CatalogTab {
final MainActivity a;

CatalogTab(MainActivity a) {
this.a = a;
}

private LinearLayout rows;
private TextView message, when;
private Button connect;

View view() {
LinearLayout root = Ui.column(a);
root.setBackgroundColor(Ui.BG);
LinearLayout list = Ui.scrolling(root, 1, LinearLayout.LayoutParams.MATCH_PARENT);
list.setPadding(Ui.dp(a, 32), Ui.dp(a, 16), Ui.dp(a, 32), Ui.dp(a, 24));
Ui.text(list, "Get mods", 30, true, Ui.GREEN);
Ui.text(list, "HMG-API's mod catalogue: mods the HMG-API project lists, each from its author's own GitHub release. "
+ "Mods they need are installed with them. Checked and downloaded over home Wi-Fi only.", 16, false, Color.GRAY);
when = Ui.text(list, "", 15, false, Color.GRAY);
message = Ui.text(list, "", 18, false, Ui.WARN);
LinearLayout buttons = Ui.row(a);
Ui.button(buttons, "Check now", new View.OnClickListener() {
@Override
public void onClick(View v) {
load(true);
}
});
connect = Ui.button(buttons, "Connect to home Wi-Fi (15 min)", new View.OnClickListener() {
@Override
public void onClick(View v) {
message.setText("Connecting to home Wi-Fi… (wireless CarPlay and Android Auto are off meanwhile)");
CatalogFlow.connect(a, new Runnable() {
@Override
public void run() {
load(true);
}
});
}
});
connect.setVisibility(View.GONE);
list.addView(buttons);
rows = new LinearLayout(a);
rows.setOrientation(LinearLayout.VERTICAL);
list.addView(rows);
load(false);
return root;
}

private void load(final boolean refresh) {
message.setText(refresh ? "Checking the catalogue…" : "Loading…");
new Ui.Job<Hmgapid.Result>() {
@Override
Hmgapid.Result work() throws Exception {
return refresh ? Hmgapid.call(180000, "engine", "catalog", "--refresh") : Hmgapid.call(60000, "engine", "catalog");
}

@Override
void done(Hmgapid.Result r, Exception e) {
rows.removeAllViews();
JSONObject d;
try {
if (e != null) throw e;
d = CatalogFlow.json(r.output);
} catch (Exception x) {
message.setText(e != null ? Hmgapid.unreachable(e) : "Couldn't read the catalogue: " + x.getMessage());
return;
}
boolean online = d.optBoolean("online");
connect.setVisibility(online ? View.GONE : View.VISIBLE);
when.setText(CatalogFlow.checked(d));
JSONArray mods = d.optJSONArray("mods");
if (d.has("error")) message.setText("Not checked: " + d.optString("error"));
else if (mods == null || mods.length() == 0) message.setText(online ? "Tap Check now to get the catalogue."
: "Not checked yet. " + d.optString("offline", "") + ". Tap Connect to home Wi-Fi, in P, to check now.");
else message.setText(online ? "" : "Offline (" + d.optString("offline") + "): showing the last check.");
for (int i = 0; mods != null && i < mods.length(); i++) row(mods.optJSONObject(i), online);
}
}.start(a);
}

private void row(final JSONObject m, boolean online) {
Ui.gap(rows, 14);
String st = m.optString("status");
boolean unfit = m.has("unfit"), hmgapiUnfit = unfit && !m.optString("unfit").startsWith("car: ");
Ui.text(rows, m.optString("name", m.optString("id")) + " " + m.optString("version"), 22, true, hmgapiUnfit ? Color.GRAY : Color.WHITE);
String what;
if ("same".equals(st)) what = "Installed" + (m.optBoolean("enabled", true) ? "" : " (turned off)");
else if ("update".equals(st)) what = "Update from " + m.optString("installed");
else if ("older".equals(st)) what = "Installed " + m.optString("installed") + " (newer than the catalogue's)";
else what = "Not installed";
Ui.text(rows, what, 16, false, "update".equals(st) ? Ui.GREEN : Color.LTGRAY);
if (m.optString("description").length() > 0) Ui.text(rows, m.optString("description"), 15, false, Color.GRAY);
JSONArray au = m.optJSONArray("authors");
StringBuilder by = new StringBuilder();
for (int i = 0; au != null && i < au.length(); i++) by.append(i > 0 ? ", " : "").append(au.optString(i));
if (by.length() > 0) Ui.text(rows, "By " + by + (m.optBoolean("trusted") ? "" : " · not on HMG-API's trusted author list"
+ ("new".equals(st) ? ": installing it needs your yes" : "")), 15, false,
m.optBoolean("trusted") ? Color.GRAY : Ui.WARN);
JSONArray req = m.optJSONArray("requires");
if (req != null && req.length() > 0) {
StringBuilder b = new StringBuilder();
for (int i = 0; i < req.length(); i++) b.append(i > 0 ? ", " : "").append(req.optString(i));
Ui.text(rows, "Needs " + b + " (installed with it if missing)", 15, false, Color.GRAY);
}
if (unfit) Ui.text(rows, hmgapiUnfit ? "Can't install: " + m.optString("unfit") : "Not listed for this head unit: " + m.optString("unfit").substring(5)
+ (m.optBoolean("any_car") ? " (you chose to use it here)" : ""),
15, false, hmgapiUnfit ? Ui.ERROR : Ui.WARN);
if (hmgapiUnfit || "older".equals(st) || ("same".equals(st) && m.optBoolean("enabled", true))) return;
final boolean update = "update".equals(st);
String label = update ? "Update" : "same".equals(st) ? "Turn on" : "Install";
Button b = Ui.button(rows, label, new View.OnClickListener() {
@Override
public void onClick(View v) {
CatalogFlow.start(a, Arrays.asList(m.optString("id")), update, new CatalogFlow.Done() {
@Override
public void installed(String output) {
CatalogFlow.applyNow(a, "Installed", MainActivity.readable(output));
load(false);
}

@Override
public void failed(String output) {
new AlertDialog.Builder(a).setTitle("Not installed").setMessage(output)
.setPositiveButton("OK", null).show();
load(false);
}

@Override
void lost(String message) {
new AlertDialog.Builder(a).setTitle("Still installing").setMessage(message)
.setPositiveButton("OK", null).show();
}
});
}
});
if (!online && !"same".equals(st)) b.setEnabled(false);
}
}
2 changes: 1 addition & 1 deletion core/app/java/hmgapi/app/LogsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ View view() {
@Override
public void onClick(View v) {
problem = true;
a.show(3);
a.show(MainActivity.LOGS);
}
});
Ui.button(bar, "Refresh", new View.OnClickListener() {
Expand Down
22 changes: 18 additions & 4 deletions core/app/java/hmgapi/app/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
* by category), Car Report, Logs.
*/
public class MainActivity extends Activity {
static final String[] TABS = { "Mods", "Settings", "Car Report", "Logs" };
static final String[] TABS = { "Installed mods", "Catalogue", "Updates", "Settings", "Car Report", "Logs" };
static final int MODS = 0, CATALOGUE = 1, UPDATES_TAB = 2, SETTINGS = 3, REPORT = 4, LOGS = 5;
private LinearLayout pills;
private FrameLayout content;
private final TextView[] tabs = new TextView[TABS.length];
Expand Down Expand Up @@ -90,7 +91,7 @@ public void onClick(View v) {
final int n = i;
LinearLayout t = Ui.column(this);
tabs[i] = new TextView(this);
tabs[i].setText(TABS[i]);
tabs[i].setText(i == UPDATES_TAB ? updatesLabel() : TABS[i]);
Ui.size(tabs[i], 21);
tabs[i].setPadding(Ui.dp(this, 4), Ui.dp(this, 6), Ui.dp(this, 4), Ui.dp(this, 8));
t.addView(tabs[i]);
Expand Down Expand Up @@ -166,11 +167,23 @@ void show(int n) {
marks[i].setVisibility(i == n ? View.VISIBLE : View.INVISIBLE);
}
content.removeAllViews();
View v = n == 0 ? new ModsTab(this).view() : n == 1 ? new SettingsTab(this).view()
: n == 2 ? new ReportTab(this).view() : new LogsTab(this).view();
tabs[UPDATES_TAB].setText(updatesLabel());
View v = n == MODS ? new ModsTab(this).view() : n == CATALOGUE ? new CatalogTab(this).view()
: n == UPDATES_TAB ? new UpdatesTab(this).view() : n == SETTINGS ? new SettingsTab(this).view()
: n == REPORT ? new ReportTab(this).view() : new LogsTab(this).view();
content.addView(v);
}

/** "Updates (n)" when the last check found any (public/updates.json, written by the engine) */
static String updatesLabel() {
try {
int n = new org.json.JSONObject(UsbFolders.read(new java.io.File("/data/hmgapi/public/updates.json"))).optInt("count");
return n > 0 ? "Updates (" + n + ")" : "Updates";
} catch (Exception e) {
return "Updates";
}
}

/** "1.0.0 · Kia EV6 (usa 260507)" from the hook runtime's status */
static String subtitle() {
try {
Expand Down Expand Up @@ -239,6 +252,7 @@ void needRestart() {

@Override
protected void onActivityResult(int request, int result, Intent data) {
if (request == UPDATES && current == MODS) show(MODS); // the Mods tab again: new mods, versions, the updates count
if (request == UPDATES && result == RESULT_OK) plan(); // mods were installed: apply them (plan first)
}

Expand Down
Loading