Compare commits

...
Author SHA1 Message Date
bonzi cad30176db fix(dashcam-archive): show unverified gear values raw instead of guessed letters 2026-12-02 11:18:36 +00:00
bonzi 33d912946e chore: drop committed __pycache__, ignore it 2026-12-02 11:17:20 +00:00
bonzi dd0d798418 feat(dashcam): USB recording folder, parked low-quality mode, per-clip drive logs on the dashboard
- Choose the recording folder (head unit, any mounted USB volume, or a typed path); real write test,
  falls back to the head unit if the stick is missing; clips/events in old folders stay managed
- USB budget bounded by stick size (its free-space figure drifts on this head unit, per upstream)
- Parked (P + standing still) records at 1.5 Mbit/s 10 fps by default (or medium/full/off); clips
  rotate on mode change; parked clips are deleted first and can age out sooner (default 7 days)
- Default driving bitrate 9 -> 6 Mbit/s; quality picker shows GB/hour
- Drive log sidecar per clip and per event (speed, SoC, range, gear, GPS), uploaded with the clip
- Dashboard: synced speed/battery/gear readouts, route map (OSM via cached server proxy), speed
  graph with click-to-seek, drive distance/top speed/battery, speed+position at event press,
  parked footage in storage meters
- Tests: parked-first deletion and parked retention
2026-12-02 11:17:07 +00:00
bonzi 58cabb214d feat(dashcam-archive): web dashboard with login form, storage meters and analytics
- Login form with session cookies (30-day remember, rate-limited, sign out everywhere)
- Overview: alerts, KPIs, storage meter, per-day recording/upload charts, driving heatmap
- Events gallery, drives with date filter, continuous drive playback with wall clock and speed
- Keep a drive / clip / marked part from the web, kept-range table, drive zip download
- Storage forecast: intake rate, days until full, expiring footage
- HTTP Range streaming (seeking, iOS), ffmpeg thumbnails + durations, strict CSP, CSRF header
- Car API unchanged
2026-12-02 10:51:58 +00:00
bonzi d5440a37f2 feat(dashcam): one-tap 'Lock dashcam event' in the control panel
- Saves 2 min before + 1 min after the press as its own MP4 (events/EVENT_*.mp4), stitched
  from the loop segments on keyframes without re-encoding
- Events are never auto-deleted (car or server) and upload before ordinary clips
- Source segments stay protected by a keep range until the event file is written; a failed
  stitch leaves the range in place so nothing is lost
- Also on the dashcam notification, the Status tab and key remapping; durations configurable
- Server stores events in events/, outside retention
2026-12-02 10:24:47 +00:00
bonzi e1202bc306 feat(dashcam): auto-offload only on home network, manual offload over phone hotspot
- Home = archive reachable on its LAN URL (impossible over a hotspot); away uses https://dashcam.molberg.cloud
- Away: nothing uploads until OFFLOAD NOW, which shows the size and confirms first
- Resumable chunked uploads (16 MB away / 64 MB home) that fit Cloudflare's 100 MB body limit
- Server: GET/PUT/POST/DELETE /api/upload/<name> resumable protocol; stale partials expire after 7 days
- LAN and remote URLs pre-filled; status tab shows network and bytes waiting
2026-12-02 10:11:04 +00:00
bonzi e175f5d73b feat(dashcam): four-camera loop recording with storage budget, auto-delete, keep ranges and server offload
- Native capture/encoder from Tommasov/MG4_Dashcam (GPL-3.0), rebuilt as libmgdashcam.so
- Storage budget (2-128 GB) and auto-delete after N days (default 30), never touching kept ranges
- Keep whole drives, whole clips, or a marked start/end inside a clip; Save button + key-remap action
- Verified offload (SHA-256 round trip) to the dashcam-archive server on pve (CT112)
- Hands the cameras to the factory 360 view; pauses while parked with the screen off
- DashcamPolicy unit tests
2026-12-02 09:58:54 +00:00
bonzi 8dc698a681 feat: climate controls, Hermes phone pairing, mic access handling and install diagnostics 2026-12-02 09:38:24 +00:00
bonzi 54772ffdac build: raise base versionCode above timestamp-based dev builds 2026-11-03 18:57:49 +00:00
bonzi 4881d80e1b build: add public AOSP platform signing key used by build.sh 2026-11-03 18:50:50 +00:00
bonzi dcbd41d37b feat: automatic settings/trip backup that survives uninstall, mic and camera tests
Dev build 0.4.1.24. Also includes previously uncommitted work in the tree.
2026-11-03 18:49:53 +00:00
alex 37a1189fe6 feat: integrate vehicle controls, audio, assistant, plugins and verified releases 2026-10-07 06:55:34 +00:00
bonzi 426435ac27 chore: publish analytics bootstrap config 2026-10-07 03:57:31 +02:00
269 changed files with 25741 additions and 647 deletions

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
# Release credentials come from Vault via ./scripts/release-dev.sh.
# Never store GITEA_TOKEN in this file or .env.
# Optional environment override for tests or another Gitea repository:
# GITEA_API_URL=https://git.molberg.cloud/api/v1/repos/alex/mg-utility
+9 -2
View File
@@ -1,10 +1,17 @@
# Generated Android build output
/build/
# Local signing material
*.keystore
*.jks
*.idsig
# In-progress WIP that isn't part of any current feature branch
/src/cloud/molberg/mgutility/SetupWizardActivity.java
# Local release credentials
.env
.env.*
!.env.example
# Private telemetry service source and runtime live outside this repository
telemetry-service/*
!telemetry-service/client-config.json
__pycache__/
+31
View File
@@ -0,0 +1,31 @@
# MG Utility release workflow
When Zeb asks to **release a new Dev build**, run this from the repository:
```bash
./scripts/release-dev.sh
```
This one-command Vault-backed workflow unlocks Bitwarden through the configured
Vault helper, reads the Gitea personal access token from the configured Vault
item, invokes the existing `scripts/release.sh` version/build/publish flow, and
verifies the published Dev APK by downloading it and comparing its SHA-256 with
the release metadata and local artifact. It also checks signature schemes,
manifest metadata, and ZIP integrity. Do not commit or push source changes.
For a calculation-only authenticated preview, use
`./scripts/release-dev.sh --dry-run`. This obtains the token from Vault and
uses the live release list; never rely on an unauthenticated dry-run for version
allocation.
Never put the Gitea token in `.env`, source, shell arguments, or logs. Defaults
use `/root/.openclaw/workspace/scripts/vault.sh` and the configured Gitea Vault
item ID in the wrapper. Override `VAULT_HELPER` or `GITEA_VAULT_ITEM_ID` only
when those locations change. If Vault, signing keystore, SDK, or network access
is unavailable, stop and report the actual blocker; do not bypass checks.
Stable releases are distinct and require explicit user intent; never use
`--stable` for a Dev request. Preserve dirty source changes: the release
process builds the current checkout and does not clean or commit it. After
publishing, report the generated version, release tag, artifact path, checksum,
and actual verification output.
+56 -2
View File
@@ -1,6 +1,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cloud.molberg.mgutility" android:versionCode="3" android:versionName="0.3.0">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cloud.molberg.mgutility" android:sharedUserId="android.uid.system" android:versionCode="1793740000" android:versionName="0.3.0">
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28" />
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
<intent>
<action android:name="android.speech.action.RECOGNIZE_SPEECH" />
</intent>
<intent>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -18,6 +24,11 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.microphone" android:required="false" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@@ -30,8 +41,10 @@
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application android:allowBackup="false" android:label="MG Utility" android:icon="@drawable/ic_mg_utility" android:theme="@style/AppTheme" android:usesCleartextTraffic="false" android:resizeableActivity="true" android:maxAspectRatio="3.0">
<application android:name=".MgApp" android:allowBackup="false" android:label="MG Utility" android:icon="@drawable/ic_launcher" android:roundIcon="@drawable/ic_launcher" android:theme="@style/AppTheme" android:usesCleartextTraffic="true" android:resizeableActivity="true" android:maxAspectRatio="3.0">
<uses-library android:name="android.car" android:required="false" />
<activity android:name=".MainActivity" android:launchMode="singleTask" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="true" android:resizeableActivity="true" android:maxAspectRatio="3.0">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -40,6 +53,7 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".ClimateActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".EnergyActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".SpeedTestActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".ChargingActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
@@ -48,20 +62,50 @@
<activity android:name=".TripMapActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".SoundboardActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".DebugActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".MicRouteDiagnosticActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".MicTestActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".DashcamActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<service android:name=".DashcamService" android:enabled="true" android:exported="false" android:stopWithTask="false" android:foregroundServiceType="camera" />
<receiver android:name=".DashcamOemReceiver" android:enabled="true" android:exported="true">
<intent-filter>
<action android:name="com.saicmotor.hmi.aroundview.startAVMActivity" />
<action android:name="com.saicmotor.hmi.aroundview.ACTION_START" />
<action android:name="com.saicmotor.hmi.aroundview.ACTION_STOP" />
</intent-filter>
<intent-filter>
<action android:name="cloud.molberg.mgutility.action.SAVE_DASHCAM_CLIP" />
</intent-filter>
</receiver>
<activity android:name=".CameraTestActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".SettingsActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".HermesSettingsActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".HermesPairActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".HermesVoiceActivity" android:taskAffinity="cloud.molberg.mgutility.hermes" android:excludeFromRecents="true" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".UpdateActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".PluginMarketplaceActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".VehicleSettingsActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".KeyRemappingActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<service android:name=".KeyRemappingAccessibilityService"
android:label="@string/key_remapping_accessibility_label"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
android:exported="true">
<intent-filter><action android:name="android.accessibilityservice.AccessibilityService" /></intent-filter>
<meta-data android:name="android.accessibilityservice" android:resource="@xml/key_remapping_accessibility_service" />
</service>
<activity android:name=".SpeedAudioActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".AdaptiveAudioLevelingActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".LiquidSoundBalanceActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".CustomThemeEditorActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".CustomThemeEditActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".ControlPanelSettingsActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".CampingModeSettingsActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".SetupWizardActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<activity android:name=".ArrivalGeofenceActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:resizeableActivity="true" android:maxAspectRatio="3.0" />
<service android:name=".TripTrackingService" android:enabled="true" android:exported="false" android:stopWithTask="false" android:foregroundServiceType="location" />
<service android:name=".MediaNotificationListener" android:label="MG Utility media information" android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" android:exported="true">
<intent-filter><action android:name="android.service.notification.NotificationListenerService" /></intent-filter>
</service>
<service android:name=".UpdateScheduler$UpdateJobService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true" />
<receiver android:name=".BootReceiver" android:enabled="true" android:exported="true" android:directBootAware="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
@@ -91,5 +135,15 @@
android:exported="true"
android:readPermission="android.permission.DUMP"
android:grantUriPermissions="false" />
<provider
android:name=".UpdateApkProvider"
android:authorities="cloud.molberg.mgutility.updates"
android:exported="false"
android:grantUriPermissions="true" />
<provider
android:name=".PluginApkProvider"
android:authorities="cloud.molberg.mgutility.plugins"
android:exported="false"
android:grantUriPermissions="true" />
</application>
</manifest>
+41 -252
View File
@@ -1,237 +1,67 @@
# MG Utility
A configurable Android home-screen replacement and vehicle dashboard for SAIC-based MG cars.
MG Utility brings live vehicle information, media, trips, charging tools, shortcuts, and custom controls into one landscape-first interface that can be selected as the vehicle's Android **Home** app.
A landscape-first Android home-screen replacement and vehicle dashboard for Android-based MG/SAIC infotainment systems.
The app is designed to run across MG vehicles by detecting available services and falling back gracefully when an OEM capability is unavailable. Vehicle services, hardware, permissions, and firmware vary by model and trim. **The MG4 Luxury 2022 is the trim used for development and live validation.**
![MG Utility home screen](docs/mg-utility-home-screen.jpg)
> **Safety first:** MG Utility is not an MG/SAIC-approved product. Configure it only while parked, follow local law, and never use the screen or controls in a way that distracts from driving. Safety-critical systems remain excluded or read-only.
> **Safety:** MG Utility is not approved by MG/SAIC. Configure it only while parked. Vehicle-affecting actions are capability-gated, reversible where possible, and excluded from safety-critical systems.
![MG Utility home screen on an MG head unit](docs/mg-utility-home-screen.jpg)
## Features
*Example home screen captured on the development vehicle: 0 km/h, 346 km estimated range, 414.3 V battery voltage, 80% SOC, 8.0 kWh drive use, and media playback.*
## Table of contents
- [What it does](#what-it-does)
- [Feature list](#feature-list)
- [Home dashboard and launcher](#home-dashboard-and-launcher)
- [Vehicle data and energy](#vehicle-data-and-energy)
- [Trips and maps](#trips-and-maps)
- [Charging tools](#charging-tools)
- [Driver utilities](#driver-utilities)
- [Settings and backup](#settings-and-backup)
- [Capability-gated vehicle settings](#capability-gated-vehicle-settings)
- [Compatibility](#compatibility)
- [Safety boundaries](#safety-boundaries)
- [Install and first run](#install-and-first-run)
- [Build from source](#build-from-source)
- [Requirements](#requirements)
- [Build](#build)
- [Permissions and privacy](#permissions-and-privacy)
- [Read-only vehicle data provider](#read-only-vehicle-data-provider)
- [Development and testing](#development-and-testing)
- [Troubleshooting](#troubleshooting)
- [The dashboard shows connecting or unavailable vehicle values](#the-dashboard-shows-connecting-or-unavailable-vehicle-values)
- [Trip tracking does not start after reboot or sleep](#trip-tracking-does-not-start-after-reboot-or-sleep)
- [Routes have no map background](#routes-have-no-map-background)
- [The music panel is empty](#the-music-panel-is-empty)
- [The visualizer is silent](#the-visualizer-is-silent)
- [A vehicle setting is unavailable](#a-vehicle-setting-is-unavailable)
- [Repository layout](#repository-layout)
- [Status and limitations](#status-and-limitations)
## What it does
MG Utility is a local-first dashboard for Android-based MG infotainment systems. It can be used as a complete replacement for the Android home experience while leaving the OEM vehicle software in place underneath it.
The main screen combines:
- vehicle state and energy information when the SAIC vehicle service is available;
- media playback information and album art;
- a configurable app drawer and quick-control panel;
- shortcuts to trips, energy, charging, settings, and other utilities;
- live audio visualisation and custom themes.
The app does not require an internet connection for its core dashboard or local trip history. Network access is used for optional features such as OpenStreetMap tiles and electricity-price data.
## Feature list
### Home dashboard and launcher
- Landscape-first MG dashboard with speed, range, battery voltage, SOC, drive use, and charging status.
- Android `HOME` intent support: choose MG Utility as the default Home app when the head unit offers that option.
- Full-width music panel with notification-based media title, artist, album art, progress, and playback controls.
- Configurable themes, palettes, fonts, home-screen options, and visualizer settings.
- Automatic daily screen-brightness schedule with smooth fade-in/fade-out (see Settings → Appearance → Screen brightness).
- Swipe-up app drawer populated from the user's pinned applications.
- Swipe-down control panel with configurable quick controls, sliders, toggles, and shortcuts.
- Physical key remapping for supported foreground actions, with short, long, double, and repeat gestures.
### Vehicle data and energy
- Read-only integration with the SAIC vehicle service where the vehicle exposes it.
- Vehicle speed, estimated range, battery voltage, state of charge, energy counters, regenerated energy/range, and charging status.
- Energy dashboard with live values and connection status.
- Graceful connecting, unavailable, and fallback states on vehicles without the expected OEM service.
- Read-only content-provider sample for companion tools and diagnostics.
### Trips and maps
- Automatic background trip tracking after first-run setup.
- Drive distance, duration, top speed, SOC drop, reported energy use, estimated-range drop, sample counts, and GPS point counts.
- Regenerative-braking event detection from positive OEM counter deltas.
- Trip history with overview, per-drive details, raw samples, route display, recovery totals, and personal bests.
- Export selected or all drives as JSON, CSV, or styled HTML reports.
- Touch-pannable and pinch-zoomable OpenStreetMap route view with attribution.
- Named arrival areas with configurable radius and enabled state.
- Arrival briefings with drive statistics and optional charging price-window recommendations.
### Charging tools
- Charging automation built from editable `IF … THEN …` blocks.
- Conditions for SOC, electricity price, and time windows, including overnight windows.
- Live Strømligning price data for Danish DK1/DK2 when network access is available.
- Top-to-bottom evaluation with last matching rule winning.
- Parked-and-connected guards before charging commands are sent.
- Does not modify the OEM reservation schedule, target SOC, or current setting.
### Driver utilities
- 0–100 km/h tester using OEM vehicle speed when available, with GPS fallback.
- Local top-five acceleration leaderboard; records remain on the device.
- Soundboard for locked, booted, regeneration-best, and battery-threshold events.
- Speed-reactive audio with configurable clip, speed range, pitch, playback rate, volume, and playback mode.
- Adaptive audio leveling with three configurable speed/multiplier points; manual media-volume changes remain the reference level.
- Optional live music visualizer using the Android audio FFT callback.
- Spectrum Bars, Oscilloscope, Speed Gauge Ring, and Ferrofluid visualizer effects.
- Ferrofluid uses the Robert Leitl WebGL2 simulation as a transparent background layer;
Android playback FFT bass energy drives its audio response. Devices without WebGL2
automatically use the bundled GLES shader fallback.
- Configurable visualizer framerate, subject to the head unit's supported capture rate.
### Settings and backup
- Centralized configuration store for themes, palettes, fonts, launcher options, pinned apps, trips, charging, vehicle defaults, key mappings, audio, and map cache settings.
- Versioned, human-readable `mg-utility-settings.json` export/import through Android's document picker.
- Reset-to-defaults action.
- Automatic migration from legacy per-feature preference stores on upgrade.
- Separate JSON, CSV, and HTML drive-log exports.
### Capability-gated vehicle settings
- Vehicle settings catalog covering captured drive/energy, assistance, convenience, lighting, trim-dependent, and status rows.
- New installations default every row to **Do not change**.
- Validated writable profiles are enabled only when the matching capability is detected.
- Saved startup profiles apply once per ignition session only after positive ignition, Park, and stationary-speed checks.
- Every one-way write is followed by a getter read-back.
- Experimental parked regeneration level 5 action with acknowledgement, previous-value capture, verification, and restoration.
- **Vehicle dashboard** — speed, estimated range, battery voltage, state of charge, energy counters, charging status, and connection state.
- **Home replacement** — use MG Utility as the Android Home app with a configurable app drawer and quick-control panel.
- **Media** — now-playing metadata, album art, playback controls, progress, and notification-based media integration.
- **Trips and maps** — automatic trip tracking, drive history, route maps, statistics, regenerative-braking events, and JSON/CSV/HTML exports.
- **Dashcam** — loop recording from the four factory cameras (native capture from [Tommasov/MG4_Dashcam](https://github.com/Tommasov/MG4_Dashcam), GPL-3.0), a storage budget, auto-delete after N days (default 30), "keep" ranges for whole drives, clips or marked parts that are never auto-deleted, and verified offload to a home server (`dashcam-archive/`).
- **Charging tools** — editable `IF … THEN …` automation rules for SOC, price, and time windows, with Park and connection safeguards.
- **Audio and visualizers** — speed-reactive audio, adaptive audio leveling, soundboard events, FFT visualizers, and Ferrofluid effects.
- **Vehicle settings** — capability-detected settings with parked/stationary checks and getter read-back after writes.
- **Customization** — themes, palettes, fonts, brightness schedules, key remapping, pinned apps, and control-panel layouts.
- **Backup and plugins** — versioned settings export/import plus a scoped Java 8 plugin SDK and marketplace foundation.
- **Local-first storage** — settings, trip history, reports, and the acceleration leaderboard remain on the head unit unless explicitly exported or an optional network feature is used.
## Compatibility
MG Utility targets Android-based SAIC/MG head units and uses capability detection rather than assuming every vehicle exposes the same private OEM interfaces.
The **MG4 Luxury 2022** is the development and validation reference. Other MG/SAIC trims and firmware versions may expose different services and capabilities. The app detects unavailable OEM services and falls back to usable local features instead of assuming compatibility.
| Area | Expected behaviour |
|---|---|
| Dashboard UI, themes, settings, local history | Available on compatible Android head units running the app. |
| Android Home replacement | Available where the head unit permits a third-party app to be selected as the default Home app. |
| Media panel | Uses Android media/notification access; playback information depends on the media app and permissions. |
| Vehicle values | Requires the vehicle's SAIC service and compatible exposed data paths. Otherwise the UI reports connecting/unavailable states. |
| Automatic trips | Vehicle-only logging can work without GPS; route and location features require location permission, a usable fix, and suitable firmware. |
| Charging automation | Requires compatible charging data/commands, a connected vehicle, Park, and electricity-price network access for price conditions. |
| Maps | Requires internet access for tiles; route data can remain visible without map tiles. |
| Audio visualizer | Requires Android audio-recording permission and a supported output-visualizer/FFT path. |
| Vehicle settings | Only validated, capability-gated profiles are writable. Unknown firmware remains read-only. |
| Physical keys | Works only for keys Android exposes to the foreground application; OEM-consumed keys may not be observable. |
Minimum Android version: **API 28**. Live vehicle data requires the vehicle's exposed SAIC service. Maps and electricity-price conditions require network access; core dashboard and local history do not.
The **MG4 Luxury 2022** is the development and validation reference, not a promise that every MG trim exposes identical services or controls. Test on the specific vehicle before relying on any optional integration.
## Install
## Safety boundaries
MG Utility deliberately keeps the risky surface small:
- The dashboard and exported vehicle data provider are read-only.
- Vehicle writes are capability-gated and limited to validated profiles.
- Automatic vehicle-profile writes require confirmed ignition/run state, Park, and speed at or below 0.5 km/h.
- One-way vehicle setters require getter read-back before the app reports success.
- ADAS, ESP/traction, safety systems, and hardware-moving commands are excluded or read-only.
- Ambient lighting is excluded where the target hardware is absent.
- Regeneration level 5 is experimental, parked-only, acknowledgement-gated, never a preset, and never an unattended startup value.
- The app does not replace firmware, alter the OEM launcher permanently, or claim OEM approval.
- Configure the app and acknowledge prompts only while parked. Keep control of the vehicle at all times.
## Install and first run
1. Obtain a build of `MG-Utility.apk` from a trusted source or build it locally using the instructions below.
2. Install it on the Android head unit using the OEM-approved installation path.
3. Open MG Utility once after installation. Open it once again after an update if Android has force-stopped the package.
4. Grant only the permissions needed for the features you intend to use:
1. Obtain `MG-Utility.apk` from a trusted release or build it locally.
2. Install it on the Android head unit using the approved installation path.
3. Open MG Utility and grant only the permissions needed for the features you use:
- location for GPS routes and arrival areas;
- notification access for media information;
- audio recording for the live music visualizer;
- any Android settings or Bluetooth permissions requested by enabled controls.
5. If Android asks which Home app to use, select MG Utility and choose the default/always option if desired.
6. Configure themes, pinned apps, the app drawer, control panel, and optional automation from **Settings**.
7. If tracking does not resume after the car sleeps, enable the head unit's **Auto-start** permission and remove MG Utility from battery/task restrictions. Some OEM firmware force-stops third-party apps and suppresses their boot broadcasts.
- audio recording for the live visualizer.
4. Select MG Utility as the default Home app if desired.
5. Configure the dashboard, apps, controls, trips, charging, and optional integrations in **Settings**.
The app is designed to coexist with the OEM software. Selecting it as Home does not uninstall or replace the underlying MG/SAIC applications.
## Build
## Build from source
Requirements: Linux, a JDK, Android SDK build-tools 34 or newer, an Android platform SDK, and the local signing keystore.
### Requirements
- Linux development environment with a JDK and Android SDK.
- Android SDK build-tools 34 or newer and an Android platform SDK.
- A local signing keystore. The repository's development keystore is intentionally not part of public artifacts and is ignored by Git.
### Build
From the repository root:
```bash
```sh
./build.sh
```
The script compiles the Java sources and resources without Gradle, creates a signed APK, verifies its signature, and writes:
The signed APK is written to:
```text
build/MG-Utility.apk
```
The manifest currently targets Android API 28 and declares a minimum Android API level of 28, matching the development MG4 head unit. The app may run on newer Android versions, but OEM behaviour and private vehicle APIs must still be validated per vehicle.
For the authenticated Dev release workflow:
Do not commit generated `build/` output, keystores, passwords, or other signing material.
## Permissions and privacy
MG Utility is local-first:
- Trip history, settings, key mappings, and the acceleration leaderboard are stored on the head unit.
- The app does not upload trip logs or leaderboard records.
- Settings and drive reports are exported only when the user explicitly chooses a destination through Android's document picker.
- OpenStreetMap tiles and Strømligning price data require network access and are optional.
- Review Android permission prompts and disable features whose permissions you do not want to grant.
- No credentials or private signing material belong in this repository.
## Read-only vehicle data provider
The exported provider exposes one typed, read-only vehicle sample for a companion process or diagnostic tool:
```bash
adb shell content call \
--uri content://cloud.molberg.mgutility.vehicle \
--method sample
```sh
./scripts/release-dev.sh
```
The returned bundle can contain state of charge, estimated range, vehicle speed, battery voltage, consumption since charge, regenerated energy/range since vehicle start, and charging status. The first call after process startup may report `status=connecting`; retry after the service binding completes.
The provider accepts shell, root, or same-app callers through the declared dump permission. It implements no write methods and sends no vehicle-control Binder transactions.
## Development and testing
The repository includes a compatibility wrapper around the shared `mg4_api28` Android emulator workflow:
The repository includes an API 28 emulator wrapper for UI and local-feature testing:
```bash
```sh
./emulator.sh start
./emulator.sh install
./emulator.sh launch
@@ -239,56 +69,15 @@ The repository includes a compatibility wrapper around the shared `mg4_api28` An
./emulator.sh stop
```
The shared emulator is API 28, landscape 1920×720, and is intended for UI, database, service-lifecycle, map, and synthetic-GPS testing. For synthetic GPS, for example:
The emulator does not include SAIC's proprietary vehicle service, so live vehicle integration must be validated on compatible hardware.
```bash
adb -s emulator-5554 emu geo fix 12.5683 55.6761
```
## Documentation
The emulator does **not** contain SAIC's proprietary `com.saicmotor.service.vehicle.VehicleService`, so live vehicle values remain unavailable there. Vehicle-service integration must be validated on compatible hardware.
- [Plugin SDK](docs/PLUGIN_SDK.md)
- [Settings navigation](docs/settings-navigation.md)
- [Vehicle settings reference](docs/STARTUP_VEHICLE_SETTINGS.md)
- [Third-party notices](THIRD_PARTY_NOTICES.md)
## Troubleshooting
## Limitations
### The dashboard shows connecting or unavailable vehicle values
Confirm that the target vehicle exposes the expected SAIC service and that the app is running on the intended head unit. This is a compatibility signal, not proof that the app is broken. The UI and local features remain usable without live OEM values.
### Trip tracking does not start after reboot or sleep
Open MG Utility once after installation/update, grant the requested setup permissions, then check Auto-start and battery/task restrictions in the OEM settings. The ongoing `MG Utility trip tracking` notification is the definitive indication that the tracker is running.
### Routes have no map background
The route line can be displayed without tiles. Check internet access and allow the OpenStreetMap tile request if a background map is required. OSM attribution is displayed in the map view.
### The music panel is empty
Enable the requested notification/media access and check that a supported media application is currently playing. Some OEM media implementations do not expose complete metadata.
### The visualizer is silent
Enable audio-recording permission and confirm that the selected visualizer effect is supported by the head unit. The visualizer uses real audio FFT callbacks and intentionally becomes silent when no output is available.
### A vehicle setting is unavailable
Unknown or unsupported profiles remain read-only by design. Do not force a setting or bypass the capability gate. Verify the vehicle trim, firmware, Park state, and stationary state first.
## Repository layout
```text
.
├── AndroidManifest.xml # Package, permissions, Home intent, services, provider
├── build.sh # Gradle-free signed APK build and verification
├── emulator.sh # Compatibility wrapper for the API 28 emulator workflow
├── docs/ # Supporting project documentation and screenshots
├── res/ # Android resources and drawable assets
├── src/ # Java application sources
├── tests/ # Test and validation material
└── README.md # This document
```
## Status and limitations
MG Utility is a vehicle-specific Android integration project intended to be adaptable across SAIC-based MG cars. Its generic UI, local storage, launcher behaviour, and fallback paths are designed for broad use; live vehicle data and vehicle settings depend on private OEM services and the specific MG trim/firmware.
Before distributing a build publicly, test it on the target vehicle, review the requested permissions, confirm the Home-app behaviour, and validate that all vehicle-affecting actions remain parked-only and capability-gated. The development reference remains the MG4 Luxury 2022.
MG Utility leaves the OEM software and firmware in place. Unknown vehicle capabilities remain read-only. Test every optional integration on the target vehicle before relying on it, and never operate the app in a way that distracts from driving.
+21
View File
@@ -26,3 +26,24 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
## QR Code generator library
`src/io/nayuki/qrcodegen/` is the unmodified Java QR Code generator library by
Project Nayuki (https://www.nayuki.io/page/qr-code-generator-library), used to
draw the Hermes pairing QR code.
MIT License. Copyright (c) Project Nayuki. The full license text is retained in
each source file header.
## MG4 Dashcam native capture
`vendor/mg4-dashcam/src/` (built into `lib/arm64-v8a/libmgdashcam.so`) is the native camera
capture, grid compositor and encoder from
[Tommasov/MG4_Dashcam](https://github.com/Tommasov/MG4_Dashcam), a fork of
[jamakr4/MG4-360-Camera-App](https://github.com/jamakr4/MG4-360-Camera-App). Only the JNI symbol
prefix and library name were changed. It statically links OpenCV 4.9.0 (Apache-2.0).
GNU General Public License v3.0. The full licence text is in `vendor/mg4-dashcam/LICENSE`.
Because this code is distributed inside the MG Utility APK, builds that include it are subject to
the GPL-3.0 terms; the corresponding source is in this repository.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+502
View File
@@ -0,0 +1,502 @@
<blk> 0
<sos/eos> 1
<unk> 2
S 3
▁THE 4
▁A 5
T 6
▁AND 7
ED 8
▁OF 9
▁TO 10
E 11
D 12
N 13
ING 14
▁IN 15
Y 16
M 17
C 18
▁I 19
A 20
P 21
▁HE 22
R 23
O 24
L 25
RE 26
I 27
U 28
ER 29
▁IT 30
LY 31
▁THAT 32
▁WAS 33
▁ 34
▁S 35
AR 36
▁BE 37
F 38
▁C 39
IN 40
B 41
▁FOR 42
OR 43
LE 44
' 45
▁HIS 46
▁YOU 47
AL 48
▁RE 49
V 50
▁B 51
G 52
RI 53
▁E 54
▁WITH 55
▁T 56
▁AS 57
LL 58
▁P 59
▁HER 60
ST 61
▁HAD 62
▁SO 63
▁F 64
W 65
CE 66
▁IS 67
ND 68
▁NOT 69
TH 70
▁BUT 71
EN 72
▁SHE 73
▁ON 74
VE 75
ON 76
SE 77
▁DE 78
UR 79
▁G 80
CH 81
K 82
TER 83
▁AT 84
IT 85
▁ME 86
RO 87
NE 88
RA 89
ES 90
IL 91
NG 92
IC 93
▁NO 94
▁HIM 95
ENT 96
IR 97
▁WE 98
H 99
▁DO 100
▁ALL 101
▁HAVE 102
LO 103
▁BY 104
▁MY 105
▁MO 106
▁THIS 107
LA 108
▁ST 109
▁WHICH 110
▁CON 111
▁THEY 112
CK 113
TE 114
▁SAID 115
▁FROM 116
▁GO 117
▁WHO 118
▁TH 119
▁OR 120
▁D 121
▁W 122
VER 123
LI 124
▁SE 125
▁ONE 126
▁CA 127
▁AN 128
▁LA 129
▁WERE 130
EL 131
▁HA 132
▁MAN 133
▁FA 134
▁EX 135
AD 136
▁SU 137
RY 138
▁MI 139
AT 140
▁BO 141
▁WHEN 142
AN 143
THER 144
PP 145
ATION 146
▁FI 147
▁WOULD 148
▁PRO 149
OW 150
ET 151
▁O 152
▁THERE 153
▁HO 154
ION 155
▁WHAT 156
▁FE 157
▁PA 158
US 159
MENT 160
▁MA 161
UT 162
▁OUT 163
▁THEIR 164
▁IF 165
▁LI 166
▁K 167
▁WILL 168
▁ARE 169
ID 170
▁RO 171
DE 172
TION 173
▁WA 174
PE 175
▁UP 176
▁SP 177
▁PO 178
IGHT 179
▁UN 180
RU 181
▁LO 182
AS 183
OL 184
▁LE 185
▁BEEN 186
▁SH 187
▁RA 188
▁SEE 189
KE 190
UL 191
TED 192
▁SA 193
UN 194
UND 195
ANT 196
▁NE 197
IS 198
▁THEM 199
CI 200
GE 201
▁COULD 202
▁DIS 203
OM 204
ISH 205
HE 206
EST 207
▁SOME 208
ENCE 209
ITY 210
IVE 211
▁US 212
▁MORE 213
▁EN 214
ARD 215
ATE 216
▁YOUR 217
▁INTO 218
▁KNOW 219
▁CO 220
ANCE 221
▁TIME 222
▁WI 223
▁YE 224
AGE 225
▁NOW 226
TI 227
FF 228
ABLE 229
▁VERY 230
▁LIKE 231
AM 232
HI 233
Z 234
▁OTHER 235
▁THAN 236
▁LITTLE 237
▁DID 238
▁LOOK 239
TY 240
ERS 241
▁CAN 242
▁CHA 243
▁AR 244
X 245
FUL 246
UGH 247
▁BA 248
▁DAY 249
▁ABOUT 250
TEN 251
IM 252
▁ANY 253
▁PRE 254
▁OVER 255
IES 256
NESS 257
ME 258
BLE 259
▁M 260
ROW 261
▁HAS 262
▁GREAT 263
▁VI 264
TA 265
▁AFTER 266
PER 267
▁AGAIN 268
HO 269
SH 270
▁UPON 271
▁DI 272
▁HAND 273
▁COM 274
IST 275
TURE 276
▁STA 277
▁THEN 278
▁SHOULD 279
▁GA 280
OUS 281
OUR 282
▁WELL 283
▁ONLY 284
MAN 285
▁GOOD 286
▁TWO 287
▁MAR 288
▁SAY 289
▁HU 290
TING 291
▁OUR 292
RESS 293
▁DOWN 294
IOUS 295
▁BEFORE 296
▁DA 297
▁NA 298
QUI 299
▁MADE 300
▁EVERY 301
▁OLD 302
▁EVEN 303
IG 304
▁COME 305
▁GRA 306
▁RI 307
▁LONG 308
OT 309
SIDE 310
WARD 311
▁FO 312
▁WHERE 313
MO 314
LESS 315
▁SC 316
▁MUST 317
▁NEVER 318
▁HOW 319
▁CAME 320
▁SUCH 321
▁RU 322
▁TAKE 323
▁WO 324
▁CAR 325
UM 326
AK 327
▁THINK 328
▁MUCH 329
▁MISTER 330
▁MAY 331
▁JO 332
▁WAY 333
▁COMP 334
▁THOUGHT 335
▁STO 336
▁MEN 337
▁BACK 338
▁DON 339
J 340
▁LET 341
▁TRA 342
▁FIRST 343
▁JUST 344
▁VA 345
▁OWN 346
▁PLA 347
▁MAKE 348
ATED 349
▁HIMSELF 350
▁WENT 351
▁PI 352
GG 353
RING 354
▁DU 355
▁MIGHT 356
▁PART 357
▁GIVE 358
▁IMP 359
▁BU 360
▁PER 361
▁PLACE 362
▁HOUSE 363
▁THROUGH 364
IAN 365
▁SW 366
▁UNDER 367
QUE 368
▁AWAY 369
▁LOVE 370
QUA 371
▁LIFE 372
▁GET 373
▁WITHOUT 374
▁PASS 375
▁TURN 376
IGN 377
▁HEAD 378
▁MOST 379
▁THOSE 380
▁SHALL 381
▁EYES 382
▁COL 383
▁STILL 384
▁NIGHT 385
▁NOTHING 386
ITION 387
HA 388
▁TELL 389
▁WORK 390
▁LAST 391
▁NEW 392
▁FACE 393
▁HI 394
▁WORD 395
▁FOUND 396
▁COUNT 397
▁OB 398
▁WHILE 399
▁SHA 400
▁MEAN 401
▁SAW 402
▁PEOPLE 403
▁FRIEND 404
▁THREE 405
▁ROOM 406
▁SAME 407
▁THOUGH 408
▁RIGHT 409
▁CHILD 410
▁FATHER 411
▁ANOTHER 412
▁HEART 413
▁WANT 414
▁TOOK 415
OOK 416
▁LIGHT 417
▁MISSUS 418
▁OPEN 419
▁JU 420
▁ASKED 421
PORT 422
▁LEFT 423
▁JA 424
▁WORLD 425
▁HOME 426
▁WHY 427
▁ALWAYS 428
▁ANSWER 429
▁SEEMED 430
▁SOMETHING 431
▁GIRL 432
▁BECAUSE 433
▁NAME 434
▁TOLD 435
▁NI 436
▁HIGH 437
IZE 438
▁WOMAN 439
▁FOLLOW 440
▁RETURN 441
▁KNEW 442
▁EACH 443
▁KIND 444
▁JE 445
▁ACT 446
▁LU 447
▁CERTAIN 448
▁YEARS 449
▁QUITE 450
▁APPEAR 451
▁BETTER 452
▁HALF 453
▁PRESENT 454
▁PRINCE 455
SHIP 456
▁ALSO 457
▁BEGAN 458
▁HAVING 459
▁ENOUGH 460
▁PERSON 461
▁LADY 462
▁WHITE 463
▁COURSE 464
▁VOICE 465
▁SPEAK 466
▁POWER 467
▁MORNING 468
▁BETWEEN 469
▁AMONG 470
▁KEEP 471
▁WALK 472
▁MATTER 473
▁TEA 474
▁BELIEVE 475
▁SMALL 476
▁TALK 477
▁FELT 478
▁HORSE 479
▁MYSELF 480
▁SIX 481
▁HOWEVER 482
▁FULL 483
▁HERSELF 484
▁POINT 485
▁STOOD 486
▁HUNDRED 487
▁ALMOST 488
▁SINCE 489
▁LARGE 490
▁LEAVE 491
▁PERHAPS 492
▁DARK 493
▁SUDDEN 494
▁REPLIED 495
▁ANYTHING 496
▁WONDER 497
▁UNTIL 498
Q 499
#0 500
#1 501
+60 -7
View File
@@ -1,34 +1,87 @@
#!/bin/sh
# Build a signed APK without Gradle. Requires Android SDK build-tools 34+ and a JDK.
# Release numbering and publishing are handled by scripts/release.sh.
set -eu
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
CHANNEL=${1:-dev}
if [ "$CHANNEL" != "dev" ] && [ "$CHANNEL" != "stable" ]; then
echo "Usage: ./build.sh [dev|stable]" >&2
exit 2
fi
SDK=${ANDROID_HOME:-${ANDROID_SDK_ROOT:-/opt/android-sdk}}
TOOLS=$(find "$SDK/build-tools" -mindepth 1 -maxdepth 1 -type d | sort -V | tail -n 1)
ANDROID_JAR=$(find "$SDK/platforms" -mindepth 2 -maxdepth 2 -name android.jar -type f | sort -V | tail -n 1)
OUT="$ROOT/build"
APK="$OUT/MG-Utility.apk"
KEYSTORE="$ROOT/mg-utility.keystore"
# Signed with the head unit's platform key (public AOSP test key, which the MG4
# ships with). Together with android:sharedUserId="android.uid.system" this is
# what grants access to /dev/video*. Same approach as Tommasov/MG4_Dashcam.
PLATFORM_KEY=${PLATFORM_KEY:-"$ROOT/signing/platform.pk8"}
PLATFORM_CERT=${PLATFORM_CERT:-"$ROOT/signing/platform.x509.pem"}
BASE_VERSION=$(sed -n 's/.*android:versionName="\([^"]*\)".*/\1/p' "$ROOT/AndroidManifest.xml" | head -n 1)
BASE_CODE=$(sed -n 's/.*android:versionCode="\([0-9]*\)".*/\1/p' "$ROOT/AndroidManifest.xml" | head -n 1)
BRANCH=${UPDATE_BRANCH:-$(git -C "$ROOT" branch --show-current 2>/dev/null || true)}
[ -n "$BRANCH" ] || BRANCH=main
if [ "$CHANNEL" = "stable" ] && [ -z "${UPDATE_BRANCH:-}" ]; then BRANCH=main; fi
if [ "$CHANNEL" = "dev" ]; then
BUILD_VERSION_CODE=${UPDATE_VERSION_CODE:-$(date -u +%s)}
BUILD_VERSION_NAME=${UPDATE_VERSION_NAME:-"${BASE_VERSION}.0"}
else
BUILD_VERSION_CODE=${UPDATE_VERSION_CODE:-$BASE_CODE}
BUILD_VERSION_NAME=${UPDATE_VERSION_NAME:-$BASE_VERSION}
fi
case "$BUILD_VERSION_CODE" in
*[!0-9]*|'') echo "versionCode must be an integer" >&2; exit 2 ;;
esac
[ "$BUILD_VERSION_CODE" -le 2147483647 ] || { echo "versionCode must fit Android's signed 32-bit limit" >&2; exit 2; }
if [ ! -f "$PLATFORM_KEY" ] || [ ! -f "$PLATFORM_CERT" ]; then
echo "Platform signing key missing: $PLATFORM_KEY / $PLATFORM_CERT" >&2
exit 1
fi
if [ -z "$TOOLS" ] || [ -z "$ANDROID_JAR" ]; then
echo "Android SDK build-tools and a platform are required (set ANDROID_HOME)." >&2
exit 1
fi
rm -rf "$OUT"
mkdir -p "$OUT/classes" "$OUT/dex" "$OUT/generated"
mkdir -p "$OUT/classes" "$OUT/dex" "$OUT/generated" "$OUT/assets" "$OUT/lib/arm64-v8a" "$OUT/vendor/sherpa"
AAR="$ROOT/vendor/sherpa-onnx/sherpa-onnx-1.13.8.aar"
KOTLIN_STDLIB="$ROOT/vendor/sherpa-onnx/kotlin-stdlib-2.0.21.jar"
if [ ! -f "$AAR" ] || [ ! -f "$KOTLIN_STDLIB" ]; then
echo "Sherpa-onnx vendor AAR and Kotlin stdlib are required." >&2
exit 1
fi
unzip -q -o "$AAR" 'classes.jar' 'jni/arm64-v8a/*.so' -d "$OUT/vendor/sherpa"
cp "$OUT/vendor/sherpa/jni/arm64-v8a/"*.so "$OUT/lib/arm64-v8a/"
# Dashcam capture/encoder (Tommasov/MG4_Dashcam, GPL-3.0). Rebuild with vendor/mg4-dashcam/build-native.sh.
DASHCAM_SO="$ROOT/vendor/mg4-dashcam/prebuilt/arm64-v8a/libmgdashcam.so"
[ -f "$DASHCAM_SO" ] || { echo "Missing $DASHCAM_SO" >&2; exit 1; }
cp "$DASHCAM_SO" "$OUT/lib/arm64-v8a/"
rm -rf "$OUT/vendor/sherpa/jni"
cp -R "$ROOT/assets/sherpa-en" "$OUT/assets/"
mkdir -p "$OUT/sherpa-classes"
(cd "$OUT/sherpa-classes" && unzip -q -o "$OUT/vendor/sherpa/classes.jar")
printf '{"schema":1,"channel":"%s","branch":"%s","versionCode":%s,"versionName":"%s"}\n' \
"$CHANNEL" "$BRANCH" "$BUILD_VERSION_CODE" "$BUILD_VERSION_NAME" > "$OUT/assets/mg-update-build.json"
"$TOOLS/aapt2" compile --dir "$ROOT/res" -o "$OUT/res.zip"
"$TOOLS/aapt2" link -I "$ANDROID_JAR" --manifest "$ROOT/AndroidManifest.xml" \
--java "$OUT/generated" -o "$OUT/resources.apk" "$OUT/res.zip"
javac -source 8 -target 8 -bootclasspath "$ANDROID_JAR" -d "$OUT/classes" \
--replace-version --version-code "$BUILD_VERSION_CODE" --version-name "$BUILD_VERSION_NAME" \
-A "$OUT/assets" --java "$OUT/generated" -o "$OUT/resources.apk" "$OUT/res.zip"
javac -source 8 -target 8 -bootclasspath "$ANDROID_JAR" \
-cp "$OUT/sherpa-classes:$KOTLIN_STDLIB" -d "$OUT/classes" \
$(find "$ROOT/src" "$OUT/generated" -name '*.java')
"$TOOLS/d8" --lib "$ANDROID_JAR" --output "$OUT/dex" $(find "$OUT/classes" -name '*.class')
"$TOOLS/d8" --lib "$ANDROID_JAR" --output "$OUT/dex" \
$(find "$OUT/classes" "$OUT/sherpa-classes" -name '*.class') "$KOTLIN_STDLIB"
cp "$OUT/resources.apk" "$OUT/MG-Utility-unsigned.apk"
(cd "$OUT/dex" && jar uf "$OUT/MG-Utility-unsigned.apk" classes.dex)
(cd "$OUT" && zip -q -r "$OUT/MG-Utility-unsigned.apk" lib)
"$TOOLS/zipalign" -f 4 "$OUT/MG-Utility-unsigned.apk" "$APK"
rm -f "$APK.idsig"
"$TOOLS/apksigner" sign \
--ks "$KEYSTORE" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android \
--key "$PLATFORM_KEY" --cert "$PLATFORM_CERT" \
--v1-signing-enabled true --v2-signing-enabled true --v3-signing-enabled true \
--v4-signing-enabled false --min-sdk-version 23 "$APK"
"$TOOLS/apksigner" verify -v --min-sdk-version 23 "$APK"
"$TOOLS/apksigner" verify -v --print-certs --min-sdk-version 23 "$APK"
echo "Built $APK"
+76
View File
@@ -0,0 +1,76 @@
# Dashcam archive server
Long-term storage for MG Utility dashcam clips. Single-file Python (stdlib only) service.
Running instance: CT112 `dashcam-archive` on pve, `http://10.0.0.148:8780` (DHCP reservation on
the Flint), data on a 1 TiB `pvepool` volume mounted at `/srv/dashcam` (`backup=0`). Also published
through the pve Cloudflare tunnel as `https://dashcam.molberg.cloud` for hotspot uploads; every
request still needs the bearer token. The bearer
token is in Vaultwarden as **MG Utility dashcam archive (CT112)** and in
`/etc/mg-dashcam-archive.env` (0600) inside the CT.
## Car-side setup
Settings → Driving → Dashcam → Storage & offload:
- Server URL: `http://10.0.0.148:8780`
- Access token: the Vault value
- Offload finished clips automatically: ON
Defaults are pre-filled: home URL `http://10.0.0.148:8780`, remote URL
`https://dashcam.molberg.cloud`. The car counts as **home** when the archive answers on the LAN
URL (impossible over a phone hotspot). At home, offload runs automatically every two minutes.
Away, nothing uploads until OFFLOAD NOW is pressed, which shows the size and confirms first.
Uploads are chunked (16 MB away, 64 MB home) and resumable, so a dropped hotspot resumes. Each clip is hashed on the car, the server
re-hashes what it received and only commits a matching file, and the car only frees the local copy
after a fresh `GET` reports the same size and SHA-256.
## Web dashboard
`https://dashcam.molberg.cloud/` (or `http://10.0.0.148:8780/` at home) redirects to a login form.
Sign in with the access token; "keep me signed in" gives a 30-day session cookie (HttpOnly,
SameSite=Strict, Secure over HTTPS), otherwise 12 hours. Failed logins are rate-limited (10 per
IP / 50 total per 15 min). The menu has "Sign out everywhere".
Tabs:
- **Overview**: alerts (car offline, disk nearly full, ffmpeg missing), KPIs, storage meter,
recorded-per-day chart with event markers, upload volume, time-of-day heatmap, weekday chart,
latest events and recent drives.
- **Events**: thumbnail gallery of locked events; play, download, delete (to `.trash`, 7 days).
- **Drives**: clips grouped into drives with date filter; play a whole drive back to back with a
real wall clock, 1-8x speed, keep the drive, a clip or a marked part, download a drive as a zip.
- **Kept**: car and web keep ranges with the clips they protect; web ranges can be removed.
- **Storage**: disk ring, breakdown, intake rate, days-until-full, what expires in 24 h / 7 days.
Drive logs: each clip can carry `<clip>.mp4.json` (uploaded by the car via
`PUT /api/telemetry/<clip>`) with speed, battery, range, gear and GPS samples. The player shows a
synced speed/battery/gear readout, a route map with a moving position marker and a clickable speed
graph. Drives show distance, top speed and battery used; events show the speed and position at the
press. Map tiles come from OpenStreetMap through the server (`/tiles/z/x/y.png`, cached 30 days in
`/srv/dashcam/.tiles`), so the page itself never talks to a third party.
Parked footage: clips the car marks `"mode":"parked"` are drawn separately and can have a shorter
server retention (`parked_retention_days`, synced from the car).
Thumbnails and exact durations need `ffmpeg`/`ffprobe` on the server (installed on CT112).
Videos stream with HTTP Range support, so seeking and iOS Safari work. Web keep ranges protect the
server copy only; they are not pushed back to the car.
## Retention
The car sends its keep ranges and auto-delete age with every offload (`PUT /api/keep`). Hourly,
the server deletes clips older than that age **unless** they overlap a keep range, and rebuilds
`/srv/dashcam/kept/<label>/` as hard links to the kept clips for easy browsing. Locked events in
`events/` are never touched by retention.
## Deploy / update
```sh
TMPD=$(ssh pve mktemp -d)
tar czf /tmp/d.tgz server.py static && scp /tmp/d.tgz mg-dashcam-archive.service pve:$TMPD/
ssh pve "pct push 112 $TMPD/d.tgz /tmp/d.tgz"
ssh pve "pct exec 112 -- tar xzf /tmp/d.tgz -C /opt/mg-dashcam-archive"
ssh pve "pct push 112 $TMPD/mg-dashcam-archive.service /etc/systemd/system/mg-dashcam-archive.service"
ssh pve "pct exec 112 -- systemctl daemon-reload"
ssh pve "pct exec 112 -- systemctl restart mg-dashcam-archive"
```
@@ -0,0 +1,19 @@
[Unit]
Description=MG Utility dashcam archive
After=network-online.target
Wants=network-online.target
[Service]
User=dashcam
Group=dashcam
EnvironmentFile=/etc/mg-dashcam-archive.env
ExecStart=/usr/bin/python3 /opt/mg-dashcam-archive/server.py
Restart=always
RestartSec=3
NoNewPrivileges=true
ProtectSystem=strict
ReadWritePaths=/srv/dashcam
PrivateTmp=true
[Install]
WantedBy=multi-user.target
File diff suppressed because it is too large. Load diff
+148
View File
@@ -0,0 +1,148 @@
:root {
--bg: #090d12; --surface: #121a22; --surface2: #1a242e; --line: #26323d;
--text: #eef3f6; --muted: #8fa1af; --cyan: #2ddaeb; --red: #ee3139; --amber: #f5ad4e;
--green: #40cf99; --blue: #5aaee0; --violet: #a68cf0; --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--cyan); text-decoration: none; }
button, .btn, select, input { font: inherit; color: inherit; }
button, .btn { cursor: pointer; border: 1px solid var(--line); background: var(--surface2); border-radius: 8px;
padding: 8px 14px; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--cyan); }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.primary:hover { background: #ff4a52; border-color: #ff4a52; }
.ghost { background: transparent; }
.small { padding: 5px 10px; font-size: 13px; }
.wide { width: 100%; justify-content: center; padding: 12px; }
.muted { color: var(--muted); }
small, .small { font-size: 12px; }
select, input[type=text], input[type=password], input[type=date], input[type=search] {
background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
input:focus, select:focus { outline: 2px solid var(--cyan); outline-offset: 0; }
/* login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 20px;
background: radial-gradient(circle at 30% 10%, #13303a 0, transparent 50%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line);
border-radius: 18px; padding: 30px; box-shadow: 0 20px 60px #0008; }
.login-card h1 { margin: 22px 0 4px; font-size: 22px; }
.login-card label { display: block; margin: 18px 0 6px; font-weight: 600; }
.login-card .check { display: flex; gap: 8px; align-items: center; font-weight: 400; color: var(--muted); }
.login-card form button.primary { margin-top: 20px; }
.pw { display: flex; gap: 8px; } .pw input { flex: 1; min-width: 0; }
.err { color: var(--red); min-height: 1.4em; margin: 10px 0 0; }
/* chrome */
.brand { display: flex; gap: 10px; align-items: center; }
.brand b { display: block; font-size: 16px; } .brand span { display: block; color: var(--muted); font-size: 12px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; padding: 12px 22px;
background: #090d12e6; backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
nav button { border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 8px; white-space: nowrap; }
nav button.on { color: var(--text); background: var(--surface2); box-shadow: inset 0 -2px 0 var(--cyan); }
.top-right { display: flex; align-items: center; gap: 8px; }
.pill { padding: 4px 10px; border-radius: 99px; font-size: 12px; background: var(--surface2); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { color: var(--green); border-color: #2b6b55; } .pill.warn { color: var(--amber); border-color: #6b5530; }
.pill.bad { color: var(--red); border-color: #6b2b2f; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 40px; background: var(--surface); border: 1px solid var(--line);
border-radius: 10px; padding: 6px; display: flex; flex-direction: column; min-width: 190px; box-shadow: 0 10px 30px #0009; }
.menu-pop[hidden], .toast[hidden] { display: none; }
.menu-pop button { border: 0; background: transparent; justify-content: flex-start; }
.menu-pop button:hover { background: var(--surface2); }
main { padding: 22px; max-width: 1500px; margin: 0 auto; }
.tab { display: none; } .tab.on { display: block; }
h2 { font-size: 15px; margin: 26px 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
h2:first-child { margin-top: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
/* cards */
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.two { grid-template-columns: 1fr 1fr; } .three { grid-template-columns: 2fr 1fr; }
@media (max-width: 900px) { .two, .three { grid-template-columns: 1fr; } .top { flex-wrap: wrap; } nav { order: 3; flex-basis: 100%; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.kpi .v { font-size: 26px; font-weight: 700; margin-top: 4px; } .kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.kpi .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card h3 { margin: 0 0 12px; font-size: 14px; }
.alert { border-color: #6b5530; background: #1d1810; }
/* meters */
.meter { height: 14px; border-radius: 99px; background: var(--surface2); overflow: hidden; display: flex; }
.meter > i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--c); vertical-align: -1px; }
.ring-wrap { display: flex; gap: 20px; align-items: center; }
.ring-wrap .big { font-size: 30px; font-weight: 700; }
.c-clips { --c: var(--blue); } .c-kept { --c: var(--green); } .c-events { --c: var(--red); } .c-other { --c: #2c3741; } .c-parked { --c: #7d8b99; } .c-free { --c: var(--surface2); }
/* charts */
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { fill: var(--muted); font-size: 10px; }
svg.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.heat { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 3px; background: var(--cyan); }
.heat-l { display: grid; grid-template-columns: repeat(24, 1fr); font-size: 10px; color: var(--muted); margin-top: 4px; }
/* galleries */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: pointer; }
.tile:hover { border-color: var(--cyan); }
.tile .th { position: relative; aspect-ratio: 1440 / 1040; background: #141c24; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .badge { position: absolute; left: 8px; top: 8px; }
.tile .dur { position: absolute; right: 8px; bottom: 8px; background: #000b; padding: 2px 7px; border-radius: 6px; font-size: 12px; }
.tile .meta { padding: 10px 12px; } .tile .meta b { display: block; }
.badge { padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.b-event { background: var(--red); color: #fff; } .b-kept { background: var(--green); color: #052; }
.b-web { background: var(--violet); color: #fff; } .b-car { background: var(--blue); color: #012; }
.list { display: flex; flex-direction: column; gap: 8px; }
.drive { display: grid; grid-template-columns: 160px 1fr auto; gap: 14px; align-items: center; background: var(--surface);
border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.drive img { width: 160px; aspect-ratio: 1440/1040; object-fit: cover; border-radius: 8px; cursor: pointer; background: #141c24; }
.drive .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 700px) { .drive { grid-template-columns: 100px 1fr; } .drive img { width: 100px; } .drive .acts { grid-column: 1 / -1; justify-content: flex-start; } }
.daybar { position: sticky; top: 62px; background: var(--bg); padding: 8px 0 4px; color: var(--muted); font-weight: 600; z-index: 1; }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* player */
.modal { position: fixed; inset: 0; background: #000c; z-index: 20; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { width: min(1200px, 100%); max-height: 100%; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-head b { margin-right: 10px; }
video { width: 100%; max-height: 68vh; background: #000; border-radius: 10px; display: block; }
.pgrid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.pgrid.has-tel { grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr); }
@media (max-width: 900px) { .pgrid.has-tel { grid-template-columns: 1fr; } }
.tel { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tel[hidden] { display: none; }
.readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.readouts div { background: var(--surface2); border-radius: 8px; padding: 8px 10px; }
.readouts .l { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.readouts b { font-size: 20px; font-variant-numeric: tabular-nums; }
.map { position: relative; overflow: hidden; border-radius: 10px; background: #1b232b; flex: 1; min-height: 220px; }
.map img { position: absolute; width: 256px; height: 256px; user-select: none; -webkit-user-drag: none; filter: brightness(.8) saturate(.7); }
.map svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.map .attr { position: absolute; right: 4px; bottom: 2px; font-size: 10px; color: #ccc; background: #0009; padding: 0 4px; border-radius: 3px; }
#speedchart svg { cursor: pointer; }
.b-parked { background: #4a5966; color: #dde; }
.stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 3px; }
.stats b { color: var(--text); font-weight: 600; }
.bigmap { height: 420px; }
.pbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.pbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.clock { font: 600 20px ui-monospace, monospace; }
.strip { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; padding-bottom: 4px; }
.strip button { flex: 0 0 auto; font-size: 12px; padding: 6px 10px; }
.strip button.on { border-color: var(--cyan); color: var(--cyan); }
.strip button.k { box-shadow: inset 0 -3px 0 var(--green); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--surface2); border: 1px solid var(--line);
padding: 10px 16px; border-radius: 10px; z-index: 30; box-shadow: 0 10px 30px #000a; }
+562
View File
@@ -0,0 +1,562 @@
(function () {
'use strict';
var S = null; // last summary
var player = {list: [], i: 0, markIn: null, markOut: null};
// ------------------------------------------------------------------ helpers
function $(id) { return document.getElementById(id); }
function h(tag, attrs, kids) {
var e = document.createElement(tag);
if (attrs) for (var k in attrs) {
if (k === 'class') e.className = attrs[k];
else if (k === 'text') e.textContent = attrs[k];
else if (k.slice(0, 2) === 'on') e.addEventListener(k.slice(2), attrs[k]);
else if (k === 'style') e.style.cssText = attrs[k]; // CSSOM: allowed under style-src 'self'
else e.setAttribute(k, attrs[k]);
}
(kids || []).forEach(function (c) { if (c != null) e.appendChild(typeof c === 'string' ? document.createTextNode(c) : c); });
return e;
}
function svg(tag, attrs, kids) {
var e = document.createElementNS('http://www.w3.org/2000/svg', tag);
for (var k in attrs || {}) e.setAttribute(k, attrs[k]);
(kids || []).forEach(function (c) { if (c) e.appendChild(typeof c === 'string' ? document.createTextNode(c) : c); });
return e;
}
function bytes(b) {
if (b == null) return '–';
var u = ['B', 'KB', 'MB', 'GB', 'TB'], i = 0;
while (b >= 1024 && i < u.length - 1) { b /= 1024; i++; }
return (b >= 100 || i === 0 ? b.toFixed(0) : b.toFixed(1)) + ' ' + u[i];
}
function dur(s) {
if (s == null) return '–';
s = Math.round(s);
var hh = Math.floor(s / 3600), mm = Math.floor(s % 3600 / 60), ss = s % 60;
if (hh) return hh + 'h ' + mm + 'm';
if (mm) return mm + 'm ' + (ss ? ss + 's' : '');
return ss + 's';
}
function pad(n) { return (n < 10 ? '0' : '') + n; }
function hms(ms) { var d = new Date(ms); return pad(d.getHours()) + ':' + pad(d.getMinutes()) + ':' + pad(d.getSeconds()); }
function hm(ms) { var d = new Date(ms); return pad(d.getHours()) + ':' + pad(d.getMinutes()); }
function day(ms) { return new Date(ms).toLocaleDateString(undefined, {weekday: 'short', day: 'numeric', month: 'short', year: 'numeric'}); }
function dayKey(ms) { var d = new Date(ms); return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate()); }
function ago(ms) {
if (!ms) return 'never';
var s = (Date.now() - ms) / 1000;
if (s < 90) return 'just now';
if (s < 5400) return Math.round(s / 60) + ' min ago';
if (s < 172800) return Math.round(s / 3600) + ' h ago';
return Math.round(s / 86400) + ' days ago';
}
function toast(t) {
var e = $('toast'); e.textContent = t; e.hidden = false;
clearTimeout(toast.t); toast.t = setTimeout(function () { e.hidden = true; }, 3500);
}
function api(method, url, body) {
return fetch(url, {method: method, credentials: 'same-origin',
headers: {'Content-Type': 'application/json', 'X-Requested-With': 'dashcam'},
body: body ? JSON.stringify(body) : undefined})
.then(function (r) {
if (r.status === 401) { location.replace('/login'); throw new Error('signed out'); }
return r.json().then(function (b) { if (!r.ok) throw new Error(b.error || r.status); return b; });
});
}
function card(cls, kids) { return h('div', {class: 'card ' + (cls || '')}, kids); }
function kpi(label, value, sub) {
return card('kpi', [h('div', {class: 'l', text: label}), h('div', {class: 'v', text: value}), sub ? h('div', {class: 's', text: sub}) : null]);
}
function clipUrl(n) { return '/clips/' + encodeURIComponent(n); }
function thumbUrl(n) { return '/thumb/' + encodeURIComponent(n); }
// ------------------------------------------------------------------ tabs
document.querySelectorAll('#tabs button').forEach(function (b) {
b.onclick = function () { showTab(b.dataset.tab); };
});
function showTab(t) {
document.querySelectorAll('#tabs button').forEach(function (b) { b.classList.toggle('on', b.dataset.tab === t); });
document.querySelectorAll('.tab').forEach(function (s) { s.classList.toggle('on', s.id === t); });
if (location.hash !== '#' + t) history.replaceState(null, '', '#' + t);
}
$('menubtn').onclick = function (e) { e.stopPropagation(); $('menu').hidden = !$('menu').hidden; };
document.addEventListener('click', function () { $('menu').hidden = true; });
$('logout').onclick = function () { api('POST', '/api/web/logout').finally(function () { location.replace('/login'); }); };
$('logoutall').onclick = function () {
if (confirm('Sign out every browser that is signed in to the dashboard?'))
api('POST', '/api/web/logout-all').finally(function () { location.replace('/login'); });
};
$('refresh').onclick = function () { load(true); };
// ------------------------------------------------------------------ load
function load(manual) {
return fetch('/api/web/summary', {credentials: 'same-origin'}).then(function (r) {
if (r.status === 401) { location.replace('/login'); throw new Error('signed out'); }
return r.json();
}).then(function (s) {
S = s;
render();
if (manual) toast('Updated');
}).catch(function (e) { if (e.message !== 'signed out') toast('Could not load: ' + e.message); });
}
function render() {
var st = S.status, seen = st.car_seen;
var pill = $('carstate');
var age = seen ? (Date.now() - seen) / 1000 : Infinity;
pill.className = 'pill ' + (age < 600 ? 'ok' : age < 86400 * 3 ? 'warn' : 'bad');
pill.textContent = seen ? 'Car seen ' + ago(seen) : 'Car never connected';
$('sub').textContent = S.totals.clips + ' clips · ' + S.totals.events + ' events';
renderOverview(); renderEvents(); renderDrives(); renderKept(); renderStorage();
}
// ------------------------------------------------------------------ overview
function storageMeter(big) {
var d = S.disk, other = Math.max(0, d.used - d.clips - d.kept - d.events - (d.parked || 0));
var parts = [['c-events', d.events, 'Events'], ['c-kept', d.kept, 'Kept'], ['c-clips', d.clips, 'Driving'], ['c-parked', d.parked || 0, 'Parked'], ['c-other', other, 'Other']];
var m = h('div', {class: 'meter', style: big ? 'height:22px' : ''});
parts.forEach(function (p) { if (p[1] > 0) m.appendChild(h('i', {class: p[0], style: 'background:var(--c);width:' + (100 * p[1] / d.total) + '%', title: p[2] + ' ' + bytes(p[1])})); });
var lg = h('div', {class: 'legend'});
parts.forEach(function (p) { lg.appendChild(h('span', {class: p[0], text: p[2] + ' ' + bytes(p[1])})); });
lg.appendChild(h('span', {class: 'c-free', text: 'Free ' + bytes(d.free)}));
return [m, lg];
}
function renderOverview() {
var el = $('overview'); el.innerHTML = '';
var t = S.totals, f = S.forecast, d = S.disk;
var alerts = [];
if (S.status.car_seen && Date.now() - S.status.car_seen > 3 * 86400000) alerts.push('The car has not contacted the archive for ' + ago(S.status.car_seen).replace(' ago', '') + '.');
if (d.free / d.total < 0.1) alerts.push('Archive disk is over 90% full.');
if (f.days_until_full != null && f.days_until_full < 30) alerts.push('At the current rate the archive fills in about ' + Math.round(f.days_until_full) + ' days.');
if (!S.server.ffmpeg) alerts.push('ffmpeg is not installed on the server: thumbnails and exact durations are unavailable.');
alerts.forEach(function (a) { el.appendChild(card('alert', [h('b', {text: '⚠ '}), a])); });
if (alerts.length) el.appendChild(h('div', {style: 'height:14px'}));
el.appendChild(h('div', {class: 'grid kpis'}, [
kpi('Locked events', String(t.events), dur(t.event_s) + ' of footage'),
kpi('Drives archived', String(t.drives), t.drives ? 'avg ' + dur(t.avg_drive_s) + ', longest ' + dur(t.longest_drive_s) : ''),
kpi('Footage', dur(t.footage_s), t.clips + ' clips' + (t.parked_s ? ' · ' + dur(t.parked_s) + ' parked' : '')),
kpi('Distance logged', (t.km || 0).toFixed(0) + ' km', t.top_kmh ? 'top speed ' + Math.round(t.top_kmh) + ' km/h' : (t.with_tel ? '' : 'appears once the car uploads drive logs')),
kpi('Archive used', bytes(d.used), bytes(d.free) + ' free of ' + bytes(d.total)),
kpi('Last upload', ago(S.status.last_upload), S.status.keep_sync ? 'keep list synced ' + ago(S.status.keep_sync) : 'keep list not synced yet'),
kpi('Retention', S.retention_days ? S.retention_days + ' days' : 'Off', f.expiring_7d ? bytes(f.expiring_7d) + ' expires within 7 days' : 'nothing expiring this week')
]));
el.appendChild(h('h2', {text: 'Storage'}));
el.appendChild(card('', storageMeter(true)));
el.appendChild(h('div', {class: 'grid three', style: 'margin-top:14px'}, [
card('', [h('h3', {text: 'Recorded per day (last 30 days)'}), barChart(S.per_day.map(function (x) { return x.rec_s / 60; }), S.per_day.map(function (x) { return x.day; }), 'min', 'var(--cyan)', S.per_day.map(function (x) { return x.events; }))]),
card('', [h('h3', {text: 'Latest events'}), latestEvents()])
]));
el.appendChild(h('div', {class: 'grid two', style: 'margin-top:14px'}, [
card('', [h('h3', {text: 'Distance per day'}), barChart(S.per_day.map(function (x) { return x.km || 0; }), S.per_day.map(function (x) { return x.day; }), 'km', 'var(--green)'),
h('h3', {text: 'Uploaded per day', style: 'margin-top:16px'}), barChart(S.per_day.map(function (x) { return x.bytes_up / 1073741824; }), S.per_day.map(function (x) { return x.day; }), 'GB', 'var(--blue)')]),
card('', [h('h3', {text: 'When you drive (time of day)'}), heat(S.by_hour), h('h3', {text: 'Day of week', style: 'margin-top:16px'}), weekBars(S.by_weekday)])
]));
var recent = S.drives.slice(0, 6);
el.appendChild(h('h2', {text: 'Recent drives'}));
el.appendChild(recent.length ? h('div', {class: 'list'}, recent.map(driveRow)) : h('div', {class: 'empty', text: 'No drives uploaded yet. Clips appear here once the car offloads at home or you press OFFLOAD NOW.'}));
}
function latestEvents() {
if (!S.events.length) return h('p', {class: 'muted', text: 'No locked events. Use “Lock dashcam event” in the car’s control panel to save 2 min before + 1 min after.'});
return h('div', {class: 'list'}, S.events.slice(0, 4).map(function (e) {
return h('div', {class: 'row', style: 'cursor:pointer', onclick: function () { openEvent(e); }}, [
h('img', {src: thumbUrl(e.name), alt: '', loading: 'lazy', style: 'width:96px;border-radius:6px;aspect-ratio:1440/1040;object-fit:cover'}),
h('div', {}, [h('b', {text: day(e.click)}), h('div', {class: 'muted small', text: 'pressed ' + hms(e.click) + ' · ' + dur(e.dur) + ' · ' + bytes(e.size)})])
]);
}));
}
function barChart(vals, labels, unit, color, marks) {
var W = 600, H = 170, P = 28, n = vals.length, max = Math.max.apply(null, vals.concat([0.001]));
var nice = niceMax(max), bw = (W - P - 6) / n;
var g = svg('svg', {viewBox: '0 0 ' + W + ' ' + H, class: 'chart', role: 'img'});
for (var i = 0; i <= 4; i++) {
var y = 10 + (H - 30) * i / 4;
g.appendChild(svg('line', {x1: P, x2: W, y1: y, y2: y, class: 'grid-l'}));
g.appendChild(svg('text', {x: P - 4, y: y + 3, 'text-anchor': 'end'}, [fmtNum(nice * (1 - i / 4))]));
}
vals.forEach(function (v, i) {
var bh = (H - 30) * v / nice, x = P + 3 + i * bw;
var r = svg('rect', {x: x + 1, y: H - 20 - bh, width: Math.max(1, bw - 2), height: Math.max(0, bh), rx: 2, fill: color});
r.appendChild(svg('title', {}, [labels[i] + ': ' + fmtNum(v) + ' ' + unit + (marks && marks[i] ? ', ' + marks[i] + ' event(s)' : '')]));
g.appendChild(r);
if (marks && marks[i]) g.appendChild(svg('circle', {cx: x + bw / 2, cy: H - 24 - bh, r: 3.5, fill: 'var(--red)'}));
if (i % 5 === 0 || i === n - 1) g.appendChild(svg('text', {x: x + bw / 2, y: H - 6, 'text-anchor': 'middle'}, [labels[i].slice(5)]));
});
return g;
}
function niceMax(m) { var p = Math.pow(10, Math.floor(Math.log10(m))), f = m / p; return (f <= 1 ? 1 : f <= 2 ? 2 : f <= 5 ? 5 : 10) * p; }
function fmtNum(v) { return v >= 100 ? v.toFixed(0) : v >= 10 ? v.toFixed(0) : v >= 1 ? v.toFixed(1) : v.toFixed(2).replace(/0+$/, '').replace(/\.$/, ''); }
function heat(arr) {
var max = Math.max.apply(null, arr.concat([1]));
var g = h('div', {class: 'heat'}, arr.map(function (v, i) {
return h('i', {style: 'opacity:' + (0.08 + 0.92 * v / max), title: pad(i) + ':00 — ' + dur(v)});
}));
var l = h('div', {class: 'heat-l'}, arr.map(function (_, i) { return h('span', {text: i % 3 === 0 ? pad(i) : ''}); }));
return h('div', {}, [g, l]);
}
function weekBars(arr) {
var names = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], max = Math.max.apply(null, arr.concat([1]));
return h('div', {class: 'list'}, arr.map(function (v, i) {
return h('div', {class: 'row'}, [h('span', {class: 'muted', style: 'width:34px', text: names[i]}),
h('div', {class: 'meter', style: 'flex:1;height:10px'}, [h('i', {style: 'background:var(--violet);width:' + (100 * v / max) + '%'})]),
h('span', {class: 'muted small', style: 'width:60px;text-align:right', text: dur(v)})]);
}));
}
// ------------------------------------------------------------------ events
function renderEvents() {
var el = $('events'); el.innerHTML = '';
el.appendChild(h('div', {class: 'row'}, [h('h2', {text: 'Locked events', style: 'margin:0'}), h('span', {class: 'spacer'}),
h('span', {class: 'muted', text: 'Never deleted automatically · ' + bytes(S.disk.events)})]));
el.appendChild(h('div', {style: 'height:12px'}));
if (!S.events.length) { el.appendChild(h('div', {class: 'empty', text: 'No locked events yet.'})); return; }
el.appendChild(h('div', {class: 'gallery'}, S.events.map(function (e) {
return h('div', {class: 'tile', onclick: function () { openEvent(e); }}, [
h('div', {class: 'th'}, [h('img', {src: thumbUrl(e.name), alt: '', loading: 'lazy'}),
h('span', {class: 'badge b-event badge', text: 'EVENT'}), h('span', {class: 'dur', text: dur(e.dur)})]),
h('div', {class: 'meta'}, [h('b', {text: day(e.click)}), h('span', {class: 'muted small', text: 'Pressed at ' + hms(e.click) + ' · ' + bytes(e.size)}),
e.at ? h('div', {class: 'stats'}, [h('span', {}, [h('b', {text: Math.round(e.at.kmh || 0) + ' km/h'})]),
e.at.soc ? h('span', {text: e.at.soc.toFixed(0) + '%'}) : null,
typeof e.at.lat === 'number' ? h('span', {text: e.at.lat.toFixed(4) + ', ' + e.at.lon.toFixed(4)}) : null]) : null])
]);
})));
}
// ------------------------------------------------------------------ drives
var driveFilter = {from: '', to: '', keptOnly: false};
function renderDrives() {
var el = $('drives'); el.innerHTML = '';
var from = h('input', {type: 'date', value: driveFilter.from}), to = h('input', {type: 'date', value: driveFilter.to});
var kept = h('input', {type: 'checkbox'}); kept.checked = driveFilter.keptOnly;
function apply() { driveFilter = {from: from.value, to: to.value, keptOnly: kept.checked}; renderDrives(); }
from.onchange = to.onchange = kept.onchange = apply;
el.appendChild(h('div', {class: 'row'}, [h('h2', {text: 'Drives', style: 'margin:0'}), h('span', {class: 'spacer'}),
h('label', {class: 'muted small'}, ['From ']), from, h('label', {class: 'muted small'}, ['to ']), to,
h('label', {class: 'row muted small'}, [kept, ' with kept footage only']),
driveFilter.from || driveFilter.to || driveFilter.keptOnly ? h('button', {class: 'ghost small', text: 'Clear', onclick: function () { driveFilter = {from: '', to: '', keptOnly: false}; renderDrives(); }}) : null]));
var list = S.drives.filter(function (d) {
var k = dayKey(d.start);
return (!driveFilter.from || k >= driveFilter.from) && (!driveFilter.to || k <= driveFilter.to) && (!driveFilter.keptOnly || d.kept > 0);
});
if (!list.length) { el.appendChild(h('div', {class: 'empty', style: 'margin-top:12px', text: S.drives.length ? 'No drives match the filter.' : 'No drives archived yet.'})); return; }
var lastDay = null, box = h('div', {class: 'list', style: 'margin-top:12px'});
list.forEach(function (d) {
var k = day(d.start);
if (k !== lastDay) { box.appendChild(h('div', {class: 'daybar', text: k})); lastDay = k; }
box.appendChild(driveRow(d));
});
el.appendChild(box);
}
function driveRow(d) {
var first = d.clips[0], last = d.clips[d.clips.length - 1];
return h('div', {class: 'drive'}, [
h('img', {src: thumbUrl(first.name), alt: '', loading: 'lazy', onclick: function () { openDrive(d, 0); }}),
h('div', {}, [
h('b', {text: hm(d.start) + ' – ' + hm(d.end)}), ' ',
d.kind === 'parked' ? h('span', {class: 'badge b-parked', text: 'PARKED'}) : null, ' ',
d.kept ? h('span', {class: 'badge b-kept', text: d.kept === d.clips.length ? 'KEPT' : d.kept + ' KEPT'}) : null,
h('div', {class: 'muted small', text: day(d.start) + ' · ' + dur(d.dur) + ' · ' + d.clips.length + ' clips · ' + bytes(d.size)}),
d.tel ? h('div', {class: 'stats'}, [
d.km ? h('span', {}, [h('b', {text: d.km.toFixed(1) + ' km'})]) : null,
d.max_kmh ? h('span', {}, ['top ', h('b', {text: Math.round(d.max_kmh) + ' km/h'})]) : null,
d.soc0 != null && d.soc1 != null ? h('span', {}, ['battery ', h('b', {text: d.soc0.toFixed(0) + '% → ' + d.soc1.toFixed(0) + '%'})]) : null,
d.parked && d.kind !== 'parked' ? h('span', {text: d.parked + ' parked clip(s)'}) : null
]) : null
]),
h('div', {class: 'acts'}, [
h('button', {class: 'small', text: '▶ Play', onclick: function () { openDrive(d, 0); }}),
h('button', {class: 'ghost small', text: 'Keep drive', onclick: function () { keepRange(d.start, d.end, 'Drive ' + day(d.start) + ' ' + hm(d.start)); }}),
h('a', {class: 'btn ghost small', text: 'Download', href: '/api/web/drive.zip?from=' + encodeURIComponent(first.name) + '&to=' + encodeURIComponent(last.name)})
])
]);
}
// ------------------------------------------------------------------ kept
function renderKept() {
var el = $('kept'); el.innerHTML = '';
el.appendChild(h('div', {class: 'row'}, [h('h2', {text: 'Kept ranges', style: 'margin:0'}), h('span', {class: 'spacer'}),
h('span', {class: 'muted', text: 'Clips inside these ranges are never auto-deleted · ' + bytes(S.disk.kept)})]));
el.appendChild(h('p', {class: 'muted small', text: 'Ranges marked CAR come from MG Utility and are managed there. WEB ranges were added here and only protect the server copy.'}));
if (!S.keep.length) { el.appendChild(h('div', {class: 'empty', text: 'Nothing kept yet. Keep a drive, a clip, or a marked part of a clip from the player.'})); return; }
var tb = h('tbody');
S.keep.forEach(function (k) {
tb.appendChild(h('tr', {}, [
h('td', {}, [h('span', {class: 'badge ' + (k.source === 'web' ? 'b-web' : 'b-car'), text: k.source.toUpperCase()})]),
h('td', {text: k.label}),
h('td', {text: day(k.start) + ' ' + hms(k.start) + ' – ' + hms(k.end)}),
h('td', {class: 'num', text: dur((k.end - k.start) / 1000)}),
h('td', {class: 'num', text: k.clips.length + ' clips · ' + bytes(k.size)}),
h('td', {}, [
k.clips.length ? h('button', {class: 'ghost small', text: '▶', onclick: function () { openClips(k.clips, 0, k.label, k.start); }}) : null,
k.source === 'web' ? h('button', {class: 'ghost small', text: 'Remove', onclick: function () {
if (!confirm('Stop keeping “' + k.label + '”? The clips become eligible for normal retention again.')) return;
api('DELETE', '/api/web/keep/' + k.id).then(function () { toast('Removed'); load(); }).catch(function (e) { toast(e.message); });
}}) : null])
]));
});
el.appendChild(card('', [h('table', {}, [h('thead', {}, [h('tr', {}, ['Source', 'Label', 'Range', 'Length', 'Footage', ''].map(function (x, i) { return h('th', {class: i > 2 && i < 5 ? 'num' : '', text: x}); }))]), tb])]));
}
// ------------------------------------------------------------------ storage
function renderStorage() {
var el = $('storage'); el.innerHTML = '';
var d = S.disk, f = S.forecast;
el.appendChild(h('h2', {text: 'Archive disk'}));
var pct = Math.round(100 * d.used / d.total);
el.appendChild(card('', [h('div', {class: 'ring-wrap'}, [ring(pct), h('div', {}, [h('div', {class: 'big', text: bytes(d.used)}),
h('div', {class: 'muted', text: 'used of ' + bytes(d.total) + ' · ' + bytes(d.free) + ' free'})])]),
h('div', {style: 'height:14px'})].concat(storageMeter(true))));
el.appendChild(h('div', {class: 'grid kpis', style: 'margin-top:14px'}, [
kpi('Average intake', bytes(f.bytes_per_day) + '/day', 'last 14 days'),
kpi('Disk full in', f.days_until_full == null ? '–' : f.days_until_full > 3650 ? '10+ years' : Math.round(f.days_until_full) + ' days', 'at the current rate, ignoring retention'),
kpi('Expiring in 24 h', bytes(f.expiring_24h), S.retention_days ? S.retention_days + '-day retention' : 'retention off'),
kpi('Expiring in 7 days', bytes(f.expiring_7d), f.next_expiry ? 'next ' + day(f.next_expiry) : ''),
kpi('Oldest clip', S.totals.oldest ? day(S.totals.oldest) : '–', S.totals.newest ? 'newest ' + day(S.totals.newest) : ''),
kpi('Thumbnails', bytes(d.thumbs), 'cache, safe to delete')
]));
el.appendChild(h('h2', {text: 'Breakdown'}));
var rows = [['Locked events', d.events, S.totals.events + ' files', 'Never deleted automatically'],
['Kept clips', d.kept, '', 'Inside a keep range'],
['Driving clips', d.clips, '', S.retention_days ? 'Deleted after ' + S.retention_days + ' days' : 'Kept until retention is enabled'],
['Parked clips', d.parked || 0, '', 'Low quality; deleted after ' + (S.parked_retention_days || S.retention_days || '–') + ' days']];
el.appendChild(card('', [h('table', {}, [h('thead', {}, [h('tr', {}, ['Type', 'Size', 'Share of footage', 'Rule'].map(function (x, i) { return h('th', {class: i === 1 || i === 2 ? 'num' : '', text: x}); }))]),
h('tbody', {}, rows.map(function (r) {
var tot = d.events + d.kept + d.clips + (d.parked || 0) || 1;
return h('tr', {}, [h('td', {text: r[0]}), h('td', {class: 'num', text: bytes(r[1])}), h('td', {class: 'num', text: Math.round(100 * r[1] / tot) + '%'}), h('td', {class: 'muted', text: r[3]})]);
}))])]));
}
function ring(pct) {
var r = 42, c = 2 * Math.PI * r, col = pct > 90 ? 'var(--red)' : pct > 75 ? 'var(--amber)' : 'var(--cyan)';
return svg('svg', {viewBox: '0 0 100 100', width: 110, height: 110}, [
svg('circle', {cx: 50, cy: 50, r: r, fill: 'none', stroke: 'var(--surface2)', 'stroke-width': 10}),
svg('circle', {cx: 50, cy: 50, r: r, fill: 'none', stroke: col, 'stroke-width': 10, 'stroke-linecap': 'round',
'stroke-dasharray': (c * pct / 100) + ' ' + c, transform: 'rotate(-90 50 50)'}),
svg('text', {x: 50, y: 56, 'text-anchor': 'middle', fill: 'var(--text)', 'font-size': 18, 'font-weight': 700}, [pct + '%'])]);
}
// ------------------------------------------------------------------ map (OSM tiles via the server's cache)
function lon2x(lon, z) { return (lon + 180) / 360 * 256 * Math.pow(2, z); }
function lat2y(lat, z) { var r = lat * Math.PI / 180; return (1 - Math.log(Math.tan(r) + 1 / Math.cos(r)) / Math.PI) / 2 * 256 * Math.pow(2, z); }
function geoPts(pts) { return pts.filter(function (p) { return typeof p.lat === 'number' && typeof p.lon === 'number' && (p.acc == null || p.acc <= 50); }); }
/** Draws tiles + a route into box; returns {mark(lat,lon)} to move the position marker. */
function drawMap(box, pts) {
box.innerHTML = '';
var g = geoPts(pts);
var W = box.clientWidth || 300, H = box.clientHeight || 220;
if (!g.length) { box.appendChild(h('div', {class: 'empty', style: 'border:0', text: 'No GPS for this footage'})); return {mark: function () {}}; }
var la = g.map(function (p) { return p.lat; }), lo = g.map(function (p) { return p.lon; });
var minLa = Math.min.apply(null, la), maxLa = Math.max.apply(null, la), minLo = Math.min.apply(null, lo), maxLo = Math.max.apply(null, lo);
var z = 17;
while (z > 3 && (lon2x(maxLo, z) - lon2x(minLo, z) > W - 40 || lat2y(minLa, z) - lat2y(maxLa, z) > H - 40)) z--;
var cx = (lon2x(minLo, z) + lon2x(maxLo, z)) / 2, cy = (lat2y(minLa, z) + lat2y(maxLa, z)) / 2;
var ox = cx - W / 2, oy = cy - H / 2, n = Math.pow(2, z);
for (var tx = Math.floor(ox / 256); tx <= Math.floor((ox + W) / 256); tx++) {
for (var ty = Math.floor(oy / 256); ty <= Math.floor((oy + H) / 256); ty++) {
if (ty < 0 || ty >= n) continue;
var img = h('img', {src: '/tiles/' + z + '/' + ((tx % n) + n) % n + '/' + ty + '.png', alt: '', loading: 'lazy'});
img.style.left = (tx * 256 - ox) + 'px'; img.style.top = (ty * 256 - oy) + 'px';
box.appendChild(img);
}
}
var s = svg('svg', {width: W, height: H});
var d = g.map(function (p, i) { return (i ? 'L' : 'M') + (lon2x(p.lon, z) - ox).toFixed(1) + ' ' + (lat2y(p.lat, z) - oy).toFixed(1); }).join(' ');
s.appendChild(svg('path', {d: d, fill: 'none', stroke: '#000', 'stroke-width': 6, 'stroke-opacity': .45, 'stroke-linejoin': 'round', 'stroke-linecap': 'round'}));
s.appendChild(svg('path', {d: d, fill: 'none', stroke: 'var(--cyan)', 'stroke-width': 3.5, 'stroke-linejoin': 'round', 'stroke-linecap': 'round'}));
var a = g[0], b = g[g.length - 1];
s.appendChild(svg('circle', {cx: lon2x(a.lon, z) - ox, cy: lat2y(a.lat, z) - oy, r: 5, fill: 'var(--green)', stroke: '#000'}));
s.appendChild(svg('circle', {cx: lon2x(b.lon, z) - ox, cy: lat2y(b.lat, z) - oy, r: 5, fill: 'var(--red)', stroke: '#000'}));
var m = svg('circle', {r: 7, fill: '#fff', stroke: 'var(--red)', 'stroke-width': 3, cx: -50, cy: -50});
s.appendChild(m);
box.appendChild(s);
box.appendChild(h('span', {class: 'attr', text: '© OpenStreetMap'}));
return {mark: function (lat, lon) {
if (typeof lat !== 'number') { m.setAttribute('cx', -50); return; }
m.setAttribute('cx', lon2x(lon, z) - ox); m.setAttribute('cy', lat2y(lat, z) - oy);
}};
}
function speedChart(pts, from, to, onSeek) {
var W = 900, H = 90, P = 26;
var g = svg('svg', {viewBox: '0 0 ' + W + ' ' + H, class: 'chart'});
if (!pts.length) return g;
var max = niceMax(Math.max.apply(null, pts.map(function (p) { return p.kmh || 0; }).concat([30])));
for (var i = 0; i <= 2; i++) {
var y = 6 + (H - 22) * i / 2;
g.appendChild(svg('line', {x1: P, x2: W, y1: y, y2: y, class: 'grid-l'}));
g.appendChild(svg('text', {x: P - 4, y: y + 3, 'text-anchor': 'end'}, [String(Math.round(max * (1 - i / 2)))]));
}
function X(t) { return P + (W - P) * (t - from) / Math.max(1, to - from); }
function Y(v) { return 6 + (H - 22) * (1 - v / max); }
var d = pts.map(function (p, i) { return (i ? 'L' : 'M') + X(p.t).toFixed(1) + ' ' + Y(p.kmh || 0).toFixed(1); }).join(' ');
g.appendChild(svg('path', {d: d + ' L' + X(pts[pts.length - 1].t) + ' ' + Y(0) + ' L' + X(pts[0].t) + ' ' + Y(0) + ' Z', fill: 'var(--cyan)', 'fill-opacity': .15}));
g.appendChild(svg('path', {d: d, fill: 'none', stroke: 'var(--cyan)', 'stroke-width': 2}));
g.appendChild(svg('text', {x: P, y: H - 2}, [hms(from)]));
g.appendChild(svg('text', {x: W, y: H - 2, 'text-anchor': 'end'}, [hms(to) + ' km/h']));
var cur = svg('line', {y1: 0, y2: H - 16, stroke: 'var(--red)', 'stroke-width': 2, x1: -10, x2: -10});
g.appendChild(cur);
g.addEventListener('click', function (e) {
var r = g.getBoundingClientRect(), x = (e.clientX - r.left) / r.width * W;
onSeek(from + (x - P) / (W - P) * (to - from));
});
g.cursorAt = function (t) { var x = X(t); cur.setAttribute('x1', x); cur.setAttribute('x2', x); };
return g;
}
function nearest(pts, t) {
if (!pts.length) return null;
var lo = 0, hi = pts.length - 1;
while (lo < hi) { var mid = (lo + hi) >> 1; if (pts[mid].t < t) lo = mid + 1; else hi = mid; }
var best = pts[lo];
if (lo > 0 && Math.abs(pts[lo - 1].t - t) < Math.abs(best.t - t)) best = pts[lo - 1];
return Math.abs(best.t - t) <= 20000 ? best : null;
}
// Only Park (1) is confirmed from the car's signal; other values are shown raw rather than guessed.
function gearName(g) { return g == null ? '–' : g === 1 ? 'P' : 'not P (' + g + ')'; }
// ------------------------------------------------------------------ keep
function keepRange(start, end, suggested) {
var label = prompt('Label for this kept footage:', suggested);
if (label === null) return;
api('POST', '/api/web/keep', {start: Math.round(start), end: Math.round(end), label: label}).then(function () {
toast('Kept — excluded from retention on the server'); load();
}).catch(function (e) { toast('Could not keep: ' + e.message); });
}
// ------------------------------------------------------------------ player
var v = $('video');
function openEvent(e) {
var before = e.dur ? Math.max(0, e.dur - 60) * 1000 : 120000; // events are N s before + 60 s after the press
player = {list: [{name: e.name, start: e.click - before, event: true, dur: e.dur}], i: 0, markIn: null, markOut: null, title: 'Event ' + day(e.click), event: e};
show();
}
function openDrive(d, i) {
player = {list: d.clips.map(function (c) { return {name: c.name, start: c.start, dur: c.dur, kept: c.kept}; }), i: i, markIn: null, markOut: null,
title: 'Drive ' + day(d.start) + ' ' + hm(d.start) + '–' + hm(d.end)};
show();
}
function openClips(names, i, title) {
var all = {};
S.drives.forEach(function (d) { d.clips.forEach(function (c) { all[c.name] = c; }); });
player = {list: names.map(function (n) { var c = all[n] || {}; return {name: n, start: c.start, dur: c.dur, kept: c.kept}; }), i: i, markIn: null, markOut: null, title: title};
show();
}
function cur() { return player.list[player.i]; }
function loadTelemetry() {
var first = player.list[0], last = player.list[player.list.length - 1];
if (first.start == null) return;
var from = first.start, to = (last.start || first.start) + (last.dur || 60) * 1000;
player.tel = []; player.telFrom = from; player.telTo = to;
$('tel').hidden = true; $('speedchart').innerHTML = '';
document.querySelector('.pgrid').classList.remove('has-tel');
fetch('/api/web/telemetry?from=' + from + '&to=' + to, {credentials: 'same-origin'}).then(function (r) { return r.json(); }).then(function (b) {
var pts = b.points || [];
player.tel = pts;
if (!pts.length) return;
$('tel').hidden = false;
document.querySelector('.pgrid').classList.add('has-tel');
player.map = drawMap($('map'), pts);
player.chart = speedChart(pts, from, to, seekWall);
$('speedchart').appendChild(player.chart);
updateTel();
}).catch(function () {});
}
function seekWall(t) {
for (var i = 0; i < player.list.length; i++) {
var c = player.list[i], end = c.start + (c.dur || 60) * 1000;
if (t >= c.start && t < end) {
var at = (t - c.start) / 1000;
if (i === player.i) v.currentTime = at; else load_(i, at);
return;
}
}
}
function updateTel() {
if (!player.tel || !player.tel.length) return;
var w = wall(); if (w == null) return;
var p = nearest(player.tel, w);
$('rSpeed').textContent = p ? Math.round(p.kmh || 0) + ' km/h' : '–';
$('rSoc').textContent = p && p.soc ? p.soc.toFixed(1) + ' %' : '–';
$('rGear').textContent = p ? gearName(p.gear) : '–';
$('rRange').textContent = p && p.range ? p.range + ' km' : '–';
$('rPos').textContent = p && typeof p.lat === 'number' ? p.lat.toFixed(5) + ', ' + p.lon.toFixed(5) + (p.acc != null ? ' ±' + p.acc + ' m' : '') : 'No GPS fix at this moment';
if (player.map) player.map.mark(p && p.lat, p && p.lon);
if (player.chart) player.chart.cursorAt(w);
}
function show() {
$('player').hidden = false;
$('ptitle').textContent = player.title;
loadTelemetry();
var isEvent = !!player.event;
$('pmarkin').hidden = $('pmarkout').hidden = $('pkeep').hidden = isEvent;
$('pprev').hidden = $('pnext').hidden = player.list.length < 2;
var strip = $('pstrip'); strip.innerHTML = '';
if (player.list.length > 1) player.list.forEach(function (c, i) {
strip.appendChild(h('button', {class: (i === player.i ? 'on ' : '') + (c.kept ? 'k' : ''), text: hm(c.start), onclick: function () { load_(i, 0); }}));
});
if (isEvent) {
var del = h('button', {class: 'ghost small', text: 'Delete event…', onclick: function () {
if (!confirm('Delete this event from the server? It goes to the trash for 7 days, and the car keeps its own copy.')) return;
api('POST', '/api/web/events/' + encodeURIComponent(player.event.name) + '/delete').then(function () { toast('Event moved to trash'); close(); load(); })
.catch(function (e) { toast(e.message); });
}});
strip.appendChild(del);
}
load_(player.i, 0);
}
function load_(i, at) {
player.i = i;
var c = cur();
v.src = clipUrl(c.name);
v.playbackRate = parseFloat($('prate').value);
v.onloadedmetadata = function () { if (at) v.currentTime = at; v.playbackRate = parseFloat($('prate').value); v.play().catch(function () {}); };
$('pdl').href = clipUrl(c.name) + '?dl=1';
$('psub').textContent = c.name;
document.querySelectorAll('#pstrip button').forEach(function (b, j) { b.classList.toggle('on', j === i); });
marks();
}
function wall() { var c = cur(); return c.start != null ? c.start + v.currentTime * 1000 : null; }
v.ontimeupdate = function () { var w = wall(); $('pclock').textContent = w ? hms(w) : '--:--:--'; updateTel(); };
v.onended = function () { if (player.i < player.list.length - 1) load_(player.i + 1, 0); };
$('pprev').onclick = function () { if (player.i > 0) load_(player.i - 1, 0); };
$('pnext').onclick = function () { if (player.i < player.list.length - 1) load_(player.i + 1, 0); };
$('prate').onchange = function () { v.playbackRate = parseFloat(this.value); };
$('pmarkin').onclick = function () { player.markIn = wall(); marks(); };
$('pmarkout').onclick = function () { player.markOut = wall(); marks(); };
$('pkeep').onclick = function () {
var a = player.markIn, b = player.markOut, c = cur();
if (a != null && b != null && b > a) return keepRange(a, b, 'Clip ' + hms(a));
keepRange(c.start, c.start + (c.dur || 60) * 1000, 'Clip ' + day(c.start) + ' ' + hms(c.start));
};
function marks() {
var a = player.markIn, b = player.markOut;
$('pmarks').textContent = a || b ? 'Marked: ' + (a ? hms(a) : '…') + ' → ' + (b ? hms(b) : '…') + (a && b && b > a ? ' (' + dur((b - a) / 1000) + ') — “Keep…” keeps this part' : '')
: 'Keep… saves the whole clip, or mark a start and end to keep just a part.';
}
function close() { v.pause(); v.removeAttribute('src'); v.load(); $('player').hidden = true; }
$('pclose').onclick = close;
$('player').onclick = function (e) { if (e.target === $('player')) close(); };
document.addEventListener('keydown', function (e) {
if ($('player').hidden || /INPUT|SELECT/.test(e.target.tagName)) return;
if (e.key === 'Escape') close();
else if (e.key === ' ') { e.preventDefault(); v.paused ? v.play() : v.pause(); }
else if (e.key === 'ArrowRight') v.currentTime += 5;
else if (e.key === 'ArrowLeft') v.currentTime -= 5;
else if (e.key === 'n') $('pnext').click();
else if (e.key === 'p') $('pprev').click();
});
// ------------------------------------------------------------------ boot
showTab((location.hash || '#overview').slice(1).replace(/[^a-z]/g, '') || 'overview');
load();
setInterval(function () { if ($('player').hidden && !document.hidden) load(); }, 60000);
})();
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="#101820"/><rect x="10" y="20" width="32" height="24" rx="5" fill="none" stroke="#2ddaeb" stroke-width="4"/><path d="M42 28l12-7v22l-12-7z" fill="#2ddaeb"/><circle cx="18" cy="27" r="3" fill="#ee3139"/></svg>

After

Width:  |  Height:  |  Size: 311 B

+82
View File
@@ -0,0 +1,82 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex">
<title>MG Dashcam</title>
<link rel="icon" href="/static/icon.svg">
<link rel="stylesheet" href="/static/app.css">
</head>
<body>
<header class="top">
<div class="brand"><img src="/static/icon.svg" alt="" width="32" height="32"><div><b>MG Dashcam</b><span id="sub">Archive</span></div></div>
<nav id="tabs">
<button data-tab="overview" class="on">Overview</button>
<button data-tab="events">Events</button>
<button data-tab="drives">Drives</button>
<button data-tab="kept">Kept</button>
<button data-tab="storage">Storage</button>
</nav>
<div class="top-right">
<span id="carstate" class="pill">…</span>
<button id="refresh" class="ghost small" title="Refresh">↻</button>
<div class="menu">
<button id="menubtn" class="ghost small">⋯</button>
<div id="menu" class="menu-pop" hidden>
<button id="logout">Sign out</button>
<button id="logoutall">Sign out everywhere</button>
</div>
</div>
</div>
</header>
<main id="app">
<section id="overview" class="tab on"></section>
<section id="events" class="tab"></section>
<section id="drives" class="tab"></section>
<section id="kept" class="tab"></section>
<section id="storage" class="tab"></section>
</main>
<div id="player" class="modal" hidden>
<div class="modal-card">
<div class="modal-head">
<div><b id="ptitle"></b><span id="psub" class="muted"></span></div>
<button id="pclose" class="ghost small" aria-label="Close">✕</button>
</div>
<div class="pgrid">
<video id="video" controls playsinline preload="metadata"></video>
<div id="tel" class="tel" hidden>
<div class="readouts">
<div><span class="l">Speed</span><b id="rSpeed">–</b></div>
<div><span class="l">Battery</span><b id="rSoc">–</b></div>
<div><span class="l">Gear</span><b id="rGear">–</b></div>
<div><span class="l">Range</span><b id="rRange">–</b></div>
</div>
<div id="map" class="map"></div>
<p id="rPos" class="muted small"></p>
</div>
</div>
<div id="speedchart"></div>
<div class="pbar">
<span id="pclock" class="clock">--:--:--</span>
<div class="pbtns">
<button id="pprev" class="ghost small">⏮ Prev</button>
<button id="pnext" class="ghost small">Next ⏭</button>
<select id="prate"><option value="1">1×</option><option value="2">2×</option><option value="4">4×</option><option value="8">8×</option></select>
<button id="pmarkin" class="ghost small">Mark start</button>
<button id="pmarkout" class="ghost small">Mark end</button>
<button id="pkeep" class="primary small">Keep…</button>
<a id="pdl" class="btn ghost small" href="#">Download</a>
</div>
</div>
<p id="pmarks" class="muted small"></p>
<div id="pstrip" class="strip"></div>
</div>
</div>
<div id="toast" class="toast" hidden></div>
<script src="/static/app.js"></script>
</body>
</html>
+30
View File
@@ -0,0 +1,30 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex">
<title>Sign in · MG Dashcam</title>
<link rel="icon" href="/static/icon.svg">
<link rel="stylesheet" href="/static/app.css">
</head>
<body class="login-body">
<main class="login-card">
<div class="brand"><img src="/static/icon.svg" alt="" width="40" height="40"><div><b>MG Dashcam</b><span>Archive</span></div></div>
<h1>Sign in</h1>
<p class="muted">Use the archive access token (Vault: “MG Utility dashcam archive (CT112)”).</p>
<form id="login" autocomplete="on">
<input type="text" name="username" value="dashcam" autocomplete="username" hidden>
<label for="token">Access token</label>
<div class="pw">
<input id="token" name="password" type="password" autocomplete="current-password" required autofocus spellcheck="false">
<button type="button" id="show" class="ghost small" aria-label="Show token">Show</button>
</div>
<label class="check"><input id="remember" type="checkbox" checked> Keep me signed in for 30 days</label>
<button type="submit" class="primary wide" id="go">Sign in</button>
<p id="err" class="err" role="alert"></p>
</form>
</main>
<script src="/static/login.js"></script>
</body>
</html>
+26
View File
@@ -0,0 +1,26 @@
(function () {
var f = document.getElementById('login'), t = document.getElementById('token'),
err = document.getElementById('err'), go = document.getElementById('go');
document.getElementById('show').onclick = function () {
t.type = t.type === 'password' ? 'text' : 'password';
this.textContent = t.type === 'password' ? 'Show' : 'Hide';
};
f.onsubmit = function (e) {
e.preventDefault();
err.textContent = '';
go.disabled = true; go.textContent = 'Signing in…';
fetch('/api/web/login', {
method: 'POST', headers: {'Content-Type': 'application/json'}, credentials: 'same-origin',
body: JSON.stringify({token: t.value.trim(), remember: document.getElementById('remember').checked})
}).then(function (r) {
return r.json().catch(function () { return {}; }).then(function (b) { return {ok: r.ok, b: b}; });
}).then(function (res) {
if (res.ok) { location.replace('/'); return; }
err.textContent = res.b.error || 'Sign-in failed';
go.disabled = false; go.textContent = 'Sign in'; t.select();
}).catch(function () {
err.textContent = 'Could not reach the server';
go.disabled = false; go.textContent = 'Sign in';
});
};
})();
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 347"><rect width="480" height="347" fill="#141c24"/><path d="M200 140h60v44h-60zM260 152l22-12v44l-22-12z" fill="#31404d"/></svg>

After

Width:  |  Height:  |  Size: 187 B

+150
View File
@@ -0,0 +1,150 @@
# Hermes agent assistant
MG Utility connects directly to Hermes Agent's native API server. It does not
use webhook routes or the dashboard's browser/OAuth session.
The native API is the appropriate car integration because it exposes durable
sessions, agent tools, message history, streaming, runs, steering, approvals,
models, skills, and toolsets through an authenticated HTTP API. The dashboard
uses a browser-oriented JSON-RPC WebSocket with short-lived authentication
tickets and does not add agent capabilities needed by this feature.
## Connecting your own Hermes (pair with phone)
MG Utility works with any Hermes Agent that has the API server platform enabled
(`API_SERVER_KEY` set; default port 8642). Nothing about a specific Hermes
instance is built into the app.
1. In MG Utility open **Settings → Misc → Hermes agent assistant** and select
**Pair with phone**. The car shows a QR code, a pairing code, and a
4-character check code.
2. Scan the QR code with your phone, or open `analytics.molberg.cloud/pair` and
type the pairing code.
3. On the phone, enter your Hermes server URL and `API_SERVER_KEY` (paste it
from a password manager), check that the check code matches the car, and tap
**Send to car**.
4. The car decrypts the details, stores the key with Android Keystore, runs the
connection test, and the phone shows **Connected**.
The phone encrypts the URL and key for that car's one-time key (ECDH P-256 +
HKDF-SHA256 + AES-256-GCM). The pairing relay only forwards ciphertext, keeps it
in memory for at most 5 minutes, and cannot read it. Codes are single-use.
The car itself must be able to reach the Hermes URL. A LAN address like
`http://192.168.1.20:8642` only works while the car is on that network. Use an
HTTPS reverse proxy or VPN for use elsewhere.
**Advanced / manual setup** on the same screen still lets you type the server
URL and key directly. The key is not included in MG Utility settings exports.
## Conversation behavior
The first prompt creates a persistent Hermes session with an in-car system
instruction. Subsequent steering-wheel prompts reuse that session, giving
Hermes conversation history and follow-up context. Select **New conversation**
in settings to rotate to a fresh session.
The car session is scoped to the instance's verified Anthropic
`claude-haiku-4-5-20251001` route for low latency. This does not change Hermes'
global model or sessions used by the dashboard and other integrations.
Every turn also tells Hermes that the user is speaking hands-free through an MG
car head unit and asks for concise, driving-safe responses. Hermes' returned
answer is displayed on the listening screen.
## Steering-wheel binding
Open **Settings → Misc → Key remapping**, capture a steering-wheel key, select
**Hermes voice assistant**, and save. MG Utility automatically stores that
action as the **Push to talk (press / release)** gesture.
For use over navigation, media, or other apps, select **Global key access** on
the key-remapping page (or **Enable global steering-wheel access** in Hermes
settings). In Android Accessibility, enable **MG Utility global keys**. Return
to key remapping and check that it says **GLOBAL KEYS ACTIVE**. This user-granted
service captures both key down and key up without requiring MG Utility to be
in the foreground. It does not request screen-content access. If another
key-filtering accessibility service owns the button, disable that conflicting
service before testing. Keys intercepted by the car firmware before Android
receives them cannot be remapped by this app.
Grant microphone access in Hermes settings before using the key. Hold it until
the popup shows **RECORDING** or **LISTENING**, speak, then release. Releasing
before the screen/microphone is ready asks you to try again rather than sending
an empty prompt. Existing Hermes mappings with old short/long gestures are
automatically interpreted as push-to-talk.
Hermes opens in its own temporary task, so closing it returns to the previously
visible app rather than bringing the MG dashboard forward. Each new press opens
a fresh voice turn, including while an earlier reply is still displayed.
Repeated down events do not restart recording; cancelled key sequences do not
send a prompt. Turning off the accessibility service cancels any held voice turn.
Pressing the key opens the listening screen. Android's speech recognizer shows
partial text live; releasing the key finalizes the transcript and sends it to
the persistent Hermes session. Microphone permission must be granted.
### Head units without Android speech recognition (automatic on-device fallback)
With the default **Automatic** voice engine, MG Utility uses Android's speech
recognizer when the head unit has one. If it has no recognizer, or it fails,
MG Utility switches to the bundled offline English sherpa-onnx model and the
microphone. No extra setup is needed beyond microphone permission. The MG4 has no
Android recognizer, so it always uses this path. The model is copied to app
storage in the background at app start (once Hermes is enabled) and after
pairing, so the first press doesn't wait for the 43 MB copy. Model loading and
decoding run on their own worker thread; audio captured while the model loads is
queued and decoded once it is ready.
### Optional transcription server
If the head unit has no Android recognition service, configure a separate
**Transcription endpoint**, **Transcription API key**, and **Transcription model**
in Hermes settings. The endpoint must accept an OpenAI-compatible multipart
`POST` containing `file` (AAC audio in an M4A container) and `model`, and return
JSON such as `{"text":"your spoken request"}`. Enter the full endpoint URL,
for example `https://your-speech-server/v1/audio/transcriptions`, and the model
name supported by that server. The key can be blank for a trusted local server
that does not require authentication. It is stored encrypted, separately from
the Hermes key. Do not enter the Hermes chat URL or API key in these fields:
this requires a speech-to-text server, not the Hermes session API.
When a transcription endpoint is configured, MG Utility uses direct microphone
recording instead of Android recognition. Hold the steering-wheel button to
record, then release to upload, transcribe, and send the text to Hermes. Live
partial text is not available in this mode. Recording is capped at 60 seconds;
reaching the limit submits automatically. Temporary audio is deleted after
upload completes or fails, or when an unfinished recording is cancelled by
closing the activity. Use HTTPS or a trusted private network: the configured
speech server receives the recording. No speech server is provisioned by the app.
Leave the endpoint blank to keep using an installed Android recognition service.
Microphone permission alone does not install such a service.
If `SpeechRecognizer` is unavailable, MG Utility now tries Android's
`ACTION_RECOGNIZE_SPEECH` activity instead. This lets head units that expose
their OEM/Google voice UI as a normal Android voice-input activity work without
another API key. That activity owns the listening session, so the system voice
dialog determines when speech ends; releasing the steering-wheel key cannot
force-stop it. Speak normally, finish, and wait for the result to return to
Hermes. If Android reports that no activity handles the intent, the OEM and
Android Auto implementations are private integrations and cannot provide their
audio/transcript to an unrelated app. In that case no app-only code can reuse
them; installing/enabling a system recognition provider or using the optional
transcription endpoint is required.
Validation: `sh tests/run_hermes_tests.sh` checks multipart upload, credential
separation, HTTP errors, and redirect rejection against a local test server.
Actual microphone capture and transcription must also be tested on the head unit.
## Server verification
The API follows the official Hermes API-server contract:
```bash
curl -H "Authorization: Bearer $API_SERVER_KEY" \
https://your-hermes-server/v1/capabilities
```
MG Utility requires the server to advertise `features.session_chat: true`, then
uses `POST /api/sessions` and `POST /api/sessions/{id}/chat`.
+35
View File
@@ -0,0 +1,35 @@
# Liquid Sound Balance
The OEM `ISmartSoundService.setSoundField(balance, fader)` takes **0 through 14 inclusive on both axes**, with **(7, 7) at dead center**. These are absolute positions, not signed offsets. Sending balance 0 selects the far left; negative positions are rejected.
Verified against the locally extracted `SystemSettingsService_eh32_P.apk`: `com.saicmotor.service.systemsettings.binder.ISmartSoundBinder.setSoundField`, source lines 503–507, rejects either argument below 0 or above `0xe` (14). The service's reset settings code initializes both axes to 7 (source lines 1227–1229). The stock `SystemSettings_eh32_P.apk` `SoundFieldBalanceView` also marks index 7 as the center of its 15-position axes.
## Resting point
Set **Resting point X** (left/right) and **Resting point Y** (front/rear), then **Save & Apply**. Both support every OEM position from 0 to 14; existing installations default to (7, 7). Reset resting point to center resets both sliders; save to persist it. Motion is relative to this anchor and clips at the cabin edges. Stopping, steady straight driving, zero power, and disabling liquid mode return to the saved point, not necessarily the center. A failed restore is retried while the service runs.
## Force-driven movement
Horizontal sway no longer uses a timer or borrows the braking/acceleration amplitude. It reads `arcsoft.avm.mCurCarWheelAngle` and combines it with road speed. Acceleration pulls sound rearward, braking forward, and a turn pushes sound outward. Holding a steady turn holds an outward displacement; straightening up releases it. Turning the wheel while parked does not cause displacement.
The lateral model is an approximation: `v² × tan(steeringDegrees / 15) / 2.7`, converted from m/s² to km/h/s for the shared threshold. The effective steering ratio (15) and wheelbase (2.7 m) are tuning assumptions, not a measured G-force sensor or a verified vehicle calibration. Speed excludes the dashboard's 1.03 display correction. Both axes use a damped spring with bounded integration steps; Bounce enables rebound, while off uses critical damping. Power limits movement to at most seven steps from the resting point, clipped to the OEM endpoints.
The confirmed property range is **−520.0000 at right lock**, **0.0000 centered**, and **+520.0000 at left lock**. Positive steering therefore produces rightward audio displacement. **Reverse steering signal direction** remains available for firmware with the opposite convention, but should stay off for this property. Live steering status displays the angle or an unavailable reason; there is no fabricated oscillation fallback.
## Steering integration evidence
The locally extracted `360Camera_eh32_P.apk` `CarManager` also reads `arcsoft.avm.mCurCarWheelAngle` with `android.os.SystemProperties.get`, followed by `Float.parseFloat`. The app uses the same system-property reader via reflection, without a proprietary SDK dependency, camera activation, sensor subscription, or additional car permissions.
Missing, malformed, non-finite, or out-of-range values lock X to the saved anchor. The property does **not** expose a timestamp, so an unchanged valid value cannot be distinguished from a stale value. Verify that the vehicle keeps it updated outside the camera screen. The integration deliberately does not substitute a guessed timer animation when the signal is missing.
## Live visualization
The settings screen polls OEM balance/fader readback on a background thread every 200 ms. The red dot is the reported sound-field position; the gold crosshair is the saved anchor. The dot is omitted when readback is unavailable rather than presenting the requested position as confirmed. This shows the mixer's position, not measured acoustic output. Numeric X/Y, media-volume step, steering, and distance-boost target accompany the view. Monitoring stops when the screen is paused.
## Distance volume compensation
The toggle defaults off; the slider sets a maximum **+0–100%** multiplier of the driver's media-volume setting (default +25%). Compensation uses the **observed OEM position**, not an unconfirmed command. Distance is `hypot(X − anchorX, Y − anchorY) / 7`, capped at 1. Front, rear, left, right, and diagonal movement all count. Seven steps or more receives the selected maximum; the anchor receives no boost. Unknown readback receives no boost.
Compensation and adaptive speed leveling share one volume controller and base-volume reference: `base × speed multiplier × distance multiplier`, capped to the actual stream range. A muted base stays muted. Manual volume changes remain authoritative. Adjustments ramp one hardware notch at a time (at least 150 ms apart while distance compensation is active), so returning to normal is smooth rather than instantaneous. Disabling compensation removes its multiplier; speed leveling remains active if enabled. Failed restoration writes retain the reference for retry. Percentage refers to hardware volume steps, not measured decibels or loudness.
Run `sh tests/run_tests.sh` for anchor, endpoint, turn direction, speed scaling, independent-axis, lost-signal, settling, and volume-curve coverage. Build with `./build.sh`. Property accessibility/update behavior and actual speaker behavior still require an in-car check. Configure settings while parked; have a passenger assess motion during a drive.
+178
View File
@@ -0,0 +1,178 @@
# MG Utility plugin SDK
The SDK lets an independently packaged plugin contribute pages, dashboard
tiles, background work, audio, and key actions without coupling plugin code to
MG Utility's Android activities. The API is Java 8 and Android API 28
compatible. SDK sources live in `src/cloud/molberg/mgutility/sdk`; the host
implementation is under `src/cloud/molberg/mgutility/plugin`.
## Minimal plugin
```java
package com.example.speed;
import cloud.molberg.mgutility.sdk.Contribution;
import cloud.molberg.mgutility.sdk.Plugin;
import cloud.molberg.mgutility.sdk.PluginContext;
public final class SpeedPlugin implements Plugin {
private PluginContext context;
@Override public void onLoad(PluginContext context) {
this.context = context;
context.logger().info("Loaded");
}
@Override public void onEnable(PluginContext context) {
context.contributions().register(new Contribution(
"speed.tile", Contribution.Type.DASHBOARD_WIDGET,
"Speed", "Show current speed", "speed://dashboard"));
}
@Override public void onDisable(PluginContext context) {
context.contributions().remove("speed.tile");
}
@Override public void onUnload(PluginContext context) { }
}
```
Lifecycle callbacks are idempotent from the host's perspective. Register
listeners/contributions in `onEnable` and remove them in `onDisable`; release
threads and players in `onUnload`. Exceptions are caught by the host and mark
the plugin as `FAILED`.
## `mg-plugin.json`
Place this file in the plugin APK's `assets/` directory:
```json
{
"schema": 1,
"id": "com.example.speed",
"name": "Speed display",
"versionName": "1.0.0",
"versionCode": 1,
"entryPoint": "com.example.speed.SpeedPlugin",
"sdkVersion": "1.0.0",
"publisher": "Example",
"description": "Displays vehicle speed on the dashboard.",
"capabilities": ["DASHBOARD", "VEHICLE_DATA_READ"],
"permissions": ["vehicle_data"]
}
```
`id` is a stable reverse-DNS-like identifier and must be unique. `entryPoint`
is the class implementing `Plugin`. `versionName` and `versionCode` identify a
release; `sdkVersion` is the SDK compatibility declaration. The parser accepts
the legacy aliases `version` and `entry` while new plugins should use the
explicit names above. Unknown manifest schema versions are rejected.
Capabilities are an allow-list requested by the plugin. The host may grant a
smaller set (for example when a vehicle does not expose telemetry). Always
check `context.hasCapability(...)` before using a capability. Available values
are `DASHBOARD`, `SETTINGS`, `AUDIO_PLAYBACK`, `VEHICLE_DATA_READ`,
`KEY_REMAP`, `BACKGROUND_WORK`, `STORAGE`, `NETWORK`, and `NOTIFICATIONS`.
## Contributions and hooks
Use `ContributionRegistry` for UI or behaviour contributions. IDs are unique
within a plugin. `HookRegistry` provides named, opaque host events and is safe
to publish from a worker thread; listeners are invoked outside the registry's
lock. Keep payload handling defensive because hosts may add fields over time.
`ScopedPreferences` is automatically namespaced by plugin ID. Never write to
the host's `mg_config` store directly. `runAsync` supplies a host-managed
executor; stop work when `onDisable` is called.
### Standard hooks
`HookRegistry` supports both custom string hooks and typed standard hooks. Typed hooks use
`PluginHook` plus an immutable `HookEvent`, so event names and common value accessors are
discoverable in the SDK and payloads can grow without breaking old plugins. The standard catalog is:
| Area | Hooks |
|---|---|
| App/display | `APP_STARTED`, `APP_STOPPED`, `SCREEN_ON`, `SCREEN_OFF`, `DASHBOARD_REFRESH`, `THEME_CHANGED` |
| Vehicle | `VEHICLE_CONNECTED`, `VEHICLE_DISCONNECTED`, `VEHICLE_STATE`, `SPEED_CHANGED`, `SOC_CHANGED`, `DRIVE_MODE_CHANGED`, `REGENERATION_CHANGED`, `CHARGING_STATE_CHANGED` |
| Media/audio | `MEDIA_STATE_CHANGED`, `AUDIO_FFT`, `VOLUME_CHANGED` |
| Input | `KEY_EVENT` |
| Trips/arrival | `TRIP_STARTED`, `TRIP_UPDATED`, `TRIP_FINISHED`, `ARRIVAL_ENTERED`, `ARRIVAL_EXITED` |
| Plugins | `PLUGIN_ENABLED`, `PLUGIN_DISABLED` |
Example typed subscription:
```java
HookRegistry.TypedListener listener = new HookRegistry.TypedListener() {
@Override public void onEvent(PluginHook hook, HookEvent event) {
double speed = event.getDouble("speedKph", 0);
context.logger().debug("speed=" + speed);
}
};
context.hooks().subscribe(PluginHook.SPEED_CHANGED, listener);
```
The host publishes events on its own threads; listeners must be quick and non-blocking. Use
`runAsync` for work. Unsubscribe in `onDisable`. Capability checks still apply: for example,
vehicle hooks require `VEHICLE_DATA_READ`, audio hooks require `AUDIO_PLAYBACK`, and key hooks
require `KEY_REMAP`.
Host code publishes typed events through `PluginHostEvents.publish(HookEvent)`; this keeps event
production decoupled from plugin loading and allows vehicle services, media listeners, and trip
tracking to feed the same bus.
## Building and testing
The current repository intentionally has no Gradle dependency. Add the SDK
source files to a plugin module and compile with Java 8 against the Android SDK
(`android.jar`). The JVM contract tests can be run with:
```sh
./tests/run_tests.sh
```
The test suite includes manifest schema/capability validation, semantic
version ranges, contribution registration, and hook subscribe/unsubscribe
behaviour.
To produce a reusable SDK jar for a plugin project, run:
```sh
./scripts/build-plugin-sdk.sh
```
The resulting `build/plugin-sdk/mg-utility-plugin-sdk.jar` contains only the
Android-free contract classes. Compile the Android host adapter against
`android.jar` when a plugin needs Android resources or activities.
## Marketplace repository format
The marketplace consumes a JSON index containing `schema` and a `plugins`
array. Each entry includes `id`, `version`, `apkUrl`, `sha256`, and optional
`sdkRange`, `entry`, `publisher`, and description fields. APK URLs must use
HTTPS and are checked against the SHA-256 digest before installation. A sample
entry is:
```json
{
"schema": 1,
"plugins": [{
"id": "com.example.speed",
"name": "Speed display",
"version": "1.0.0",
"apkUrl": "https://example.org/speed-1.0.0.apk",
"sha256": "…64 lowercase hexadecimal characters…",
"sdkRange": "1.0.0-2.0.0",
"entry": "com.example.speed.SpeedPlugin"
}]
}
```
## Roadmap
Three existing features — speed-reactive audio, the soundboard, and the button-key remapper —
will become SDK consumers during the next phase. They keep their current screens and behaviour
until their code is rewritten against `Contribution`, `HookRegistry`, and `ScopedPreferences`
and published from the official repository index. Removing in-app code only happens once a
replacement plugin is signed and published, so functionality never disappears without a working
install path.
+147
View File
@@ -0,0 +1,147 @@
# Settings navigation
`SettingsActivity` contains seven tabs. Switching tabs resets the content scroll
position to the top after layout. Refreshing the same tab (including returning
from another page or changing a picker value) retains its scroll offset, clamped
to the available content height. Theme-driven view rebuilds retain that offset too.
Existing preference stores, keys, defaults, and feature callbacks are unchanged.
Brightness scheduling and music display controls remain grouped inline on
Dashboard; there are no separate brightness or music-display activities.
All internal activity destinations below are registered in `AndroidManifest.xml`.
OEM destinations depend on the software installed on the head unit.
## Tab → group → setting → destination
```text
Vehicle
Vehicle settings → VehicleSettingsActivity (capability-gated startup profile)
Vehicle power / Turn off car → confirmation → guarded OEM power-off request
Default drive mode → VehicleSettingsActivity (current value shown in hub)
Default recovery level → VehicleSettingsActivity (current value shown in hub)
Driving
Performance
0–100 tester → SpeedTestActivity
Trip tracking
Trip reports → TripsActivity
Arrival areas → ArrivalGeofenceActivity
Drive log sample interval → inline single-choice dialog
Maps
Map tile cache storage → preset selector / custom MB dialog
Map cache current use → read-only usage summary
Charging
Charging management
Charging automation → ChargingActivity
Energy dashboard → EnergyActivity
Vehicle charging
Vehicle charging settings → OEM ChargeManagementActivity
Audio
Sound and volume
Soundboard → SoundboardActivity
Speed reactive audio → SpeedAudioActivity
Adaptive audio leveling → AdaptiveAudioLevelingActivity
Liquid Sound Balance → LiquidSoundBalanceActivity
Assistant
Hermes agent assistant → HermesSettingsActivity
Dashboard
Theme
Font size → inline slider
Theme → CustomThemeEditorActivity
Navigation
Page animations → inline toggle
Panels
App Drawer → inline toggle
App drawer opacity → inline slider
Control panel → inline toggle
Configure control panel → ControlPanelSettingsActivity
Widgets Panel → inline toggle
Camping mode
Camping mode settings → CampingModeSettingsActivity
Brightness schedule
Automatic brightness → inline toggle; rearms BrightnessScheduler
Peak brightness time → time picker; rearms BrightnessScheduler
Dark brightness time → time picker; rearms BrightnessScheduler
Peak brightness → inline percentage slider; rearms BrightnessScheduler
Dark brightness → inline percentage slider; rearms BrightnessScheduler
Transition duration → inline minutes slider; rearms BrightnessScheduler
Music player
Music Player → inline toggle / notification-access permission prompt
Music visualizer
Music Visualizer → inline toggle
Visualizer framerate → single-choice dialog
Visualizer effect → single-choice dialog
Visualizer opacity → inline slider
Apps
Pinned apps
Reorder → inline toggle enabling drag-and-drop ordering
Pinned app tile → launch configured app/activity
Edit / remove pin → existing tile controls and dialogs
Add New → pin editor with app/activity pickers (outside reorder mode)
System
Setup
Run setup wizard → SetupWizardActivity (review mode)
Diagnostics
Debug console → DebugActivity
Keys and launcher
Key remapping → KeyRemappingActivity
Official SAIC launcher → OEM home activity; generic home intent fallback
Change Launcher → Android home settings; default-app settings fallback
OEM and system tools
Engineer mode → OEM EngineeringModeActivity
SAIC vehicle settings → OEM VehicleSettingsActivity
System settings → OEM SettingsActivity
Software updates
Software updates → UpdateActivity
Plugins
Plugin marketplace → PluginMarketplaceActivity
Transfer
Included settings → informational dialog listing ConfigStore sections
Export settings → Android create-document picker; JSON export
Import settings → Android open-document picker; JSON import
Reset
Reset settings → confirmation dialog; reset preferences and recreate hub
```
## External destinations
| Entry | Component or intent |
| --- | --- |
| Vehicle charging settings | `com.saicmotor.hmi.vehiclesettings/com.saicmotor.hmi.vehiclesettings.chargemanagement.ui.ChargeManagementActivity` |
| Official SAIC launcher | `com.saicmotor.hmi.launcher/com.saicmotor.hmi.launcher.ui.MainActivity`; fallback `ACTION_MAIN` + `CATEGORY_HOME` |
| Change Launcher | `Settings.ACTION_HOME_SETTINGS`; fallback `Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS` |
| Engineer mode | `com.saicmotor.hmi.engmode/com.saicmotor.hmi.engmode.home.ui.EngineeringModeActivity` |
| SAIC vehicle settings | `com.saicmotor.hmi.vehiclesettings/com.saicmotor.hmi.vehiclesettings.vehicleconfig.ui.VehicleSettingsActivity` |
| System settings | `com.saicmotor.hmi.systemsettings/com.saicmotor.hmi.systemsettings.SettingsActivity` |
| Music Player permission | `Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS` |
## Entry points and migration
The original Driving tab is split into Vehicle and Driving. Charging stays
together. Misc is split into Audio and System. Appearance becomes Dashboard.
Apps retains its pinned-app tools. Config is incorporated into System, with the
old export section list available through Included settings instead of repeated rows.
`EXTRA_CATEGORY` remains an integer intent extra with zero-based tab order:
Vehicle (0), Driving (1), Charging (2), Audio (3), Dashboard (4), Apps (5), System (6).
The control panel's automatic-brightness settings shortcut uses
`SettingsActivity.CATEGORY_DASHBOARD` rather than the old Appearance index (3).
Vehicle default summary rows intentionally share the same destination; editing
remains centralized in the capability-gated vehicle settings page.
## Manual navigation checks
On a head unit or emulator, scroll down Dashboard, switch to System, and confirm
System starts at the top; repeat between other tabs. Scroll to brightness or
visualizer controls, change a picker, and confirm the same-tab refresh preserves
position. Return from a child page and from notification access, and verify the
same behavior. Change theme/font size, then verify the rebuilt tab and controls.
Check the control panel brightness shortcut lands on Dashboard. Exercise pinned
app editing and reordering, and verify settings still export/import as before.
Diagnostic upload and reset require explicit confirmation; cancel them during
navigation-only checks.
+68
View File
@@ -0,0 +1,68 @@
# Manual vehicle power off
Open **Settings → Vehicle → Vehicle settings → Vehicle power → TURN OFF CAR**.
The button opens a confirmation prompt. Cancel, Back, or leaving the activity
does not submit a command. Confirming checks the live vehicle state on a worker
thread, then sends the same power-off request used by the captured OEM app.
This is not an Android shutdown/reboot or a screen-blanking command.
## OEM evidence
Source: local `mg4-luxury-2022-info` checkout at commit
`6bbf5385d0de5f8102979b5d13b04f8b1930fefc`.
Paths below are relative to that repository's `device-info/decomp/` directory.
| Evidence | File and method |
| --- | --- |
| OEM button opens a warning dialog; confirmation passes integer `2` | `com.saicmotor.hmi.vehiclesettings/smali/com/saicmotor/hmi/vehiclesettings/vehicleconfig/viewmodel/VehiclePowerViewModel.smali`: `defPowerOffClick`, `lambda$defPowerOffClick$0$VehiclePowerViewModel` |
| Button enabled only when gear equals `1` (Park) | Same view model: `updatePowerModeSwitch`; `vehicleconfig/repository/VehiclePowerRepository.smali`: `getPowerModeSwitchEnable` returns `getCarGear()` |
| Repository forwards the request to `VehicleSettingManager.setPowerModeSwitch` | `com.saicmotor.hmi.vehiclesettings/smali/com/saicmotor/hmi/vehiclesettings/vehicleconfig/repository/VehiclePowerRepository.smali`: `setPowerModeSwitch` |
| Setter uses token `com.saicmotor.sdk.vehiclesettings.IVehicleSettingService`, transaction `0xad`, integer argument, no reply, one-way flag `1` | `com.saicmotor.hmi.vehiclesettings/smali_classes2/com/saicmotor/sdk/vehiclesettings/IVehicleSettingService$Stub$Proxy.smali`: `setPowerModeSwitch` |
| Vehicle service validates the value, then writes integer global property `0x2140d70f` using `CarComfortableManager` | `com.saicmotor.service.vehicle/smali/com/saicmotor/service/vehicle/binder/VehicleSettingBinder.smali`: `setPowerModeSwitch` |
| Captured service version | `com.saicmotor.service.vehicle/apktool.yml`: `VehicleSettingsService.44041` |
| OEM UI explicitly says the function is available in P | `com.saicmotor.hmi.vehiclesettings/res/values/strings.xml`: `vehicle_power_off_all_sub` |
MG Utility uses its existing exported vehicle hub connection and retrieves the
`vehiclesetting` and `vehiclecondition` binders. It does **not** directly write the
underlying global vehicle property, bypass the OEM service, or invoke a generic
shutdown broadcast.
## Safety and compatibility behavior
- Only the exact captured service version `VehicleSettingsService.44041` and
matching setting/condition Binder descriptors are allowed. Other versions
report unsupported rather than guessing transaction compatibility.
- A fresh gear reading must be `1` (Park). A fresh speed reading must be finite
and exactly zero. Unknown, negative, nonzero, or invalid readings block the
command. Gear is read again after speed, before submitting the request.
- These sequential reads are not an atomic vehicle-state guarantee. The driver
must remain safely parked, and the OEM vehicle service remains responsible for
applying the request and any vehicle-side interlocks.
- No action runs at startup, on service connection, or from a saved preference.
There is no key-remapping, plugin, automation, or remote-trigger integration.
- Cancel never calls the controller. Leaving the activity or a service
disconnect dismisses an outstanding confirmation. A request already confirmed
and submitted cannot be recalled by navigating away.
- Repeated/concurrent calls on the same controller cannot send a second command.
Failed or uncertain writes are never retried automatically. A blocked safety
check can be tried again through a new explicit confirmation.
- A successful one-way Binder submission is reported as **request sent**, not
proof that the car powered off. No fallback write or retry occurs if the OEM
service rejects or ignores the command.
## Validation and limits
`VehiclePowerOffControllerTest` covers cancellation/no side effects, unsupported
service, unknown/non-Park gears, invalid/nonzero speed, gear changes during the
check, read/write failures, duplicate and concurrent requests, and new state
reads after a blocked attempt. `VehiclePowerOffGatewayTest` uses fake Binder/Parcel
objects to check exact transaction/payload/flags, version/descriptor rejection,
missing services, telemetry failures, and failed submission. The Android build
checks the real Android API and UI wiring.
Static OEM analysis identifies the command path, but does not prove this
sideloaded app can successfully power off the physical car. No physical shutdown
is executed during development validation. First on-car validation must be
supervised with the car safely stationary in Park, and should verify cancellation
before explicitly confirming a power-off request. Use OEM controls if MG Utility
reports an unsupported service or unavailable telemetry.
+7
View File
@@ -0,0 +1,7 @@
# MG Utility plugin template
This is a dependency-light Java 8 starter plugin. Compile the SDK sources in
`src/cloud/molberg/mgutility/sdk` together with `src/main/java`, package
`assets/mg-plugin.json` into your APK, and publish the APK plus SHA-256 digest
in a marketplace repository index. See [PLUGIN_SDK.md](../../docs/PLUGIN_SDK.md)
for lifecycle and repository details.
@@ -0,0 +1,13 @@
{
"schema": 1,
"id": "com.example.mgutility.template",
"name": "MG Utility plugin template",
"versionName": "0.1.0",
"versionCode": 1,
"entryPoint": "com.example.mgutility.template.TemplatePlugin",
"sdkVersion": "1.0.0",
"publisher": "Your name",
"description": "Minimal plugin template.",
"capabilities": ["DASHBOARD", "VEHICLE_DATA_READ"],
"permissions": []
}
@@ -0,0 +1,28 @@
package com.example.mgutility.template;
import cloud.molberg.mgutility.sdk.Contribution;
import cloud.molberg.mgutility.sdk.Plugin;
import cloud.molberg.mgutility.sdk.PluginContext;
import cloud.molberg.mgutility.sdk.PluginHook;
import cloud.molberg.mgutility.sdk.HookRegistry;
/** Copy this class and change the manifest ID to start a plugin. */
public final class TemplatePlugin implements Plugin {
private HookRegistry.TypedListener speedListener;
@Override public void onEnable(PluginContext context) {
context.contributions().register(new Contribution(
"template.tile", Contribution.Type.HOME_TILE,
"Template", "A plugin-provided home tile", "template://tile"));
speedListener = new HookRegistry.TypedListener() {
@Override public void onEvent(PluginHook hook, cloud.molberg.mgutility.sdk.HookEvent event) {
context.logger().debug("speed=" + event.getDouble("speedKph", 0));
}
};
if (context.hasCapability(cloud.molberg.mgutility.sdk.PluginCapability.VEHICLE_DATA_READ))
context.hooks().subscribe(PluginHook.SPEED_CHANGED, speedListener);
}
@Override public void onDisable(PluginContext context) {
context.contributions().remove("template.tile");
if (speedListener != null) context.hooks().unsubscribe(PluginHook.SPEED_CHANGED, speedListener);
}
}
+4
View File
@@ -0,0 +1,4 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
+5
View File
@@ -0,0 +1,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M14.5,17c0,1.65-1.35,3-3,3s-3-1.35-3-3h2c0,0.55,0.45,1,1,1s1-0.45,1-1s-0.45-1-1-1H2v-2h9.5 C13.15,14,14.5,15.35,14.5,17z M19,6.5C19,4.57,17.43,3,15.5,3S12,4.57,12,6.5h2C14,5.67,14.67,5,15.5,5S17,5.67,17,6.5 S16.33,8,15.5,8H2v2h13.5C17.43,10,19,8.43,19,6.5z M18.5,11H2v2h16.5c0.83,0,1.5,0.67,1.5,1.5S19.33,16,18.5,16v2 c1.93,0,3.5-1.57,3.5-3.5S20.43,11,18.5,11z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" />
</vector>
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4zM11 20v-5.5H9L13 7v5.5h2L11 20z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M17.71,7.71L12,2h-1v7.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L11,14.41V22h1l5.71-5.71L13.41,12L17.71,7.71z M13,5.83l1.88,1.88L13,9.59V5.83z M14.88,16.29L13,18.17v-3.76L14.88,16.29z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M11,21h-1l1-7H7.5c-0.88,0-0.33-0.75-0.31-0.78C8.48,10.94,10.42,7.54,13.01,3h1l-1,7h3.51c0.4,0,0.62,0.19,0.4,0.66 C12.97,17.55,11,21,11,21z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M20 15.31L23.31 12 20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69zM12 18V6c3.31 0 6 2.69 6 6s-2.69 6-6 6z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M5,20h14v-2H5V20z M19,9h-4V3H9v6H5l7,7L19,9z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12 10.9c-.61 0-1.1.49-1.1 1.1s.49 1.1 1.1 1.1c.61 0 1.1-.49 1.1-1.1s-.49-1.1-1.1-1.1zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm2.19 12.19L6 18l3.81-8.19L18 6l-3.81 8.19z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M2.5,19h19v2h-19V19z M22.07,9.64c-0.21-0.8-1.04-1.28-1.84-1.06L14.92,10l-6.9-6.43L6.09,4.08l4.14,7.17l-4.97,1.33 l-1.97-1.54l-1.45,0.39l2.59,4.49c0,0,7.12-1.9,16.57-4.43C21.81,11.26,22.28,10.44,22.07,9.64z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M7 18h2V6H7v12zm4 4h2V2h-2v20zm-8-8h2v-4H3v4zm12 4h2V6h-2v12zm4-8v4h2v-4h-2z" />
</vector>
+1
View File
@@ -0,0 +1 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#FFFFFFFF" android:pathData="M12,2a10,10 0,1 0,0 20a10,10 0,1 0,0 -20m1,15h-2v-2h2v2m0,-4h-2c0,-3 3,-3 3,-5a2,2 0,1 0,-4 0H8a4,4 0,1 1,8 0c0,3 -3,3 -3,5"/></vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-9 3h2v2h-2V8zm0 3h2v2h-2v-2zM8 8h2v2H8V8zm0 3h2v2H8v-2zm-1 2H5v-2h2v2zm0-3H5V8h2v2zm9 7H8v-2h8v2zm0-4h-2v-2h2v2zm0-3h-2V8h2v2zm3 3h-2v-2h2v2zm0-3h-2V8h2v2z" />
</vector>
+15
View File
@@ -0,0 +1,15 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<size android:width="64dp" android:height="64dp" />
<gradient android:angle="315"
android:startColor="#203443"
android:centerColor="#111E2B"
android:endColor="#080E17" />
<corners android:radius="16dp" />
</shape>
</item>
<item android:drawable="@drawable/ic_mg_utility"
android:left="6dp" android:top="6dp"
android:right="6dp" android:bottom="6dp" />
</layer-list>
+7
View File
@@ -0,0 +1,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:angle="315"
android:startColor="#203443"
android:centerColor="#111E2B"
android:endColor="#080E17" />
</shape>
+3
View File
@@ -0,0 +1,3 @@
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_mg_utility"
android:inset="20.37037%" />
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z" />
</vector>
+4
View File
@@ -0,0 +1,4 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M10.67,13.02C10.45,13.01,10.23,13,10,13c-2.42,0-4.68,0.67-6.61,1.82C2.51,15.34,2,16.32,2,17.35V20h9.26 C10.47,18.87,10,17.49,10,16C10,14.93,10.25,13.93,10.67,13.02z" />
<path android:fillColor="#FFFFFFFF" android:pathData="M20.75,16c0-0.22-0.03-0.42-0.06-0.63l1.14-1.01l-1-1.73l-1.45,0.49c-0.32-0.27-0.68-0.48-1.08-0.63L18,11h-2l-0.3,1.49 c-0.4,0.15-0.76,0.36-1.08,0.63l-1.45-0.49l-1,1.73l1.14,1.01c-0.03,0.21-0.06,0.41-0.06,0.63s0.03,0.42,0.06,0.63l-1.14,1.01 l1,1.73l1.45-0.49c0.32,0.27,0.68,0.48,1.08,0.63L16,21h2l0.3-1.49c0.4-0.15,0.76-0.36,1.08-0.63l1.45,0.49l1-1.73l-1.14-1.01 C20.72,16.42,20.75,16.22,20.75,16z M17,18c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2S18.1,18,17,18z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM15 19l-6-2.11V5l6 2.11V19z" />
</vector>
+30 -7
View File
@@ -1,9 +1,32 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<path android:fillColor="#10252B" android:pathData="M4,6C4,3.8 5.8,2 8,2H40C42.2,2 44,3.8 44,6V42C44,44.2 42.2,46 40,46H8C5.8,46 4,44.2 4,42Z"/>
<path android:fillColor="#00D8A5" android:pathData="M15,12H33C34.1,12 35,12.9 35,14V34C35,35.1 34.1,36 33,36H15C13.9,36 13,35.1 13,34V14C13,12.9 13.9,12 15,12M35,19H39V29H35Z"/>
<path android:fillColor="#10252B" android:pathData="M26,15L18,26H24L22,33L30,22H24Z"/>
xmlns:aapt="http://schemas.android.com/aapt"
android:width="64dp"
android:height="64dp"
android:viewportWidth="64"
android:viewportHeight="64">
<path
android:fillColor="#00000000"
android:strokeWidth="4.5"
android:strokeLineCap="round"
android:pathData="M14.32,49.68A25,25 0,1 1,49.68 49.68">
<aapt:attr name="android:strokeColor">
<gradient android:type="linear"
android:startX="10" android:startY="10"
android:endX="53" android:endY="51">
<item android:offset="0" android:color="#46CFFF" />
<item android:offset="0.5" android:color="#00D4D6" />
<item android:offset="1" android:color="#48EDB5" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M36.9,15.5C37.6,14.7 38.8,15.4 38.5,16.4L35.1,28H43.4C44.5,28 45,29.2 44.3,30L27.1,49.5C26.4,50.3 25.2,49.6 25.5,48.6L28.9,37H20.6C19.5,37 19,35.8 19.7,35Z">
<aapt:attr name="android:fillColor">
<gradient android:type="linear"
android:startX="27" android:startY="16"
android:endX="37" android:endY="50"
android:startColor="#FFFFFF"
android:endColor="#CDE8F2" />
</aapt:attr>
</path>
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M14,2c1.82,0,3.53,0.5,5,1.35C16.01,5.08,14,8.3,14,12s2.01,6.92,5,8.65C17.53,21.5,15.82,22,14,22C8.48,22,4,17.52,4,12 S8.48,2,14,2z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M8 5v14l11-7z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M19 13H5v-2h14v2z" />
</vector>
+4
View File
@@ -0,0 +1,4 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12,5V2L8,6l4,4V7c3.31,0,6,2.69,6,6c0,2.97-2.17,5.43-5,5.91v2.02c3.95-0.49,7-3.85,7-7.93C20,8.58,16.42,5,12,5z" />
<path android:fillColor="#FFFFFFFF" android:pathData="M6,13c0-1.65,0.67-3.15,1.76-4.24L6.34,7.34C4.9,8.79,4,10.79,4,13c0,4.08,3.05,7.44,7,7.93v-2.02 C8.17,18.43,6,15.97,6,13z" />
</vector>
+4
View File
@@ -0,0 +1,4 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z" />
<path android:fillColor="#FFFFFFFF" android:pathData="M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z" />
</vector>
+4
View File
@@ -0,0 +1,4 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M5.35,5.64c-0.9,-0.64 -1.12,-1.88 -0.49,-2.79c0.63,-0.9 1.88,-1.12 2.79,-0.49c0.9,0.64 1.12,1.88 0.49,2.79c-0.64,0.9 -1.88,1.12 -2.79,0.49zM16,19L8.93,19c-1.48,0 -2.74,-1.08 -2.96,-2.54L4,7L2,7l1.99,9.76C4.37,19.2 6.47,21 8.94,21L16,21v-2zM16.23,15h-4.88l-1.03,-4.1c1.58,0.89 3.28,1.54 5.15,1.22L15.47,10c-1.63,0.31 -3.44,-0.27 -4.69,-1.25L9.14,7.48c-0.23,-0.18 -0.49,-0.3 -0.76,-0.38c-0.32,-0.09 -0.66,-0.12 -0.99,-0.06h-0.02c-1.23,0.22 -2.05,1.39 -1.84,2.61l1.35,5.92C7.16,16.98 8.39,18 9.83,18h6.85l3.82,3l1.5,-1.5l-5.77,-4.5z"/>
<path android:fillColor="#FFFFFFFF" android:pathData="M17,3.5c0,0.8 0.5,1.2 0.8,1.6c0.3,0.4 0.7,0.9 0.7,1.9c0,1 -0.5,1.6 -0.9,2l-0.7,-0.7c0.3,-0.3 0.6,-0.7 0.6,-1.3c0,-0.6 -0.2,-0.9 -0.5,-1.3C16.6,5.3 16,4.6 16,3.5c0,-1 0.5,-1.6 0.9,-2l0.7,0.7C17.3,2.5 17,2.9 17,3.5zM20.5,3.5c0,0.8 0.5,1.2 0.8,1.6c0.3,0.4 0.7,0.9 0.7,1.9c0,1 -0.5,1.6 -0.9,2l-0.7,-0.7c0.3,-0.3 0.6,-0.7 0.6,-1.3c0,-0.6 -0.2,-0.9 -0.5,-1.3C20.1,5.3 19.5,4.6 19.5,3.5c0,-1 0.5,-1.6 0.9,-2l0.7,0.7C20.8,2.5 20.5,2.9 20.5,3.5z"/>
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M17 4h3v16h-3zM5 14h3v6H5zm6-5h3v11h-3z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M20.38 8.57l-1.23 1.85a8 8 0 0 1-.22 7.58H5.07A8 8 0 0 1 15.58 6.85l1.85-1.23A10 10 0 0 0 3.35 19a2 2 0 0 0 1.72 1h13.85a2 2 0 0 0 1.74-1 10 10 0 0 0-.27-10.44zm-9.79 6.84a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M6 6h12v12H6z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M2 20h20v-4H2v4zm2-3h2v2H4v-2zM2 4v4h20V4H2zm4 3H4V5h2v2zm-4 7h20v-4H2v4zm2-3h2v2H4v-2z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M6.99 11L3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M17 1.01L7 1c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99zM17 19H7V5h10v14zm-1-6h-3V8h-2v5H8l4 4 4-4z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M15,13V5c0-1.66-1.34-3-3-3S9,3.34,9,5v8c-1.21,0.91-2,2.37-2,4c0,2.76,2.24,5,5,5s5-2.24,5-5C17,15.37,16.21,13.91,15,13z M11,11V5c0-0.55,0.45-1,1-1s1,0.45,1,1v1h-1v1h1v1v1h-1v1h1v1H11z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M15 1H9v2h6V1zm-4 13h2V8h-2v6zm8.03-6.61l1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM12 20c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M21,10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-0.1c-2.73,2.71-2.73,7.08,0,9.79s7.15,2.71,9.88,0 C18.32,15.65,19,14.08,19,12.1h2c0,1.98-0.88,4.55-2.64,6.29c-3.51,3.48-9.21,3.48-12.72,0c-3.5-3.47-3.53-9.11-0.02-12.58 s9.14-3.47,12.65,0L21,3V10.12z M12.5,8v4.25l3.5,2.08l-0.72,1.21L11,13V8H12.5z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M5,20h14v-2H5V20z M5,10h4v6h6v-6h4l-7-7L5,10z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M23,12l-2.44-2.79l0.34-3.69L17.29,4.7L15.4,1.5L12,2.96L8.6,1.5L6.71,4.69L3.1,5.5l0.34,3.7L1,12l2.44,2.79l-0.34,3.7 l3.61,0.82L8.6,22.5l3.4-1.47l3.4,1.46l1.89-3.19l3.61-0.82l-0.34-3.69L23,12z M10.94,15.54L7.4,12l1.41-1.41l2.12,2.12l4.24-4.24 l1.41,1.41L10.94,15.54z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M17 10.5V7c0-0.55-0.45-1-1-1H4c-0.55 0-1 0.45-1 1v10c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1v-3.5l4 4v-11l-4 4z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z" />
</vector>
+3
View File
@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z" />
</vector>
Loaded 100 of 269 files, more files were not shown because too many files have changed in this diff. Show more