The header strip now always shows the original 'RANGE N KM •
BATTERY X.X V' line. While a charge or discharge session is active,
the same line is extended with the instantaneous power, current,
remaining minutes and ETA. The animated status label is rendered on a
second row underneath so the two no longer overlap, and the redundant
'CHARGING'/'DISCHARGING' prefix is removed from the label since the
prefix is now redundant with the animated status itself.
Also fix the broken ETA text: 'DateFormat.format("DONE HH:mm", ...)'
treated the literal 'DONE' as a date pattern token, producing
'DONSun 21:47'. The literal is now appended outside the format string
so the ETA renders as 'DONE 21:47'.
A small helper shrinks the first-line text when the extended string
exceeds 94%% of the screen width, keeping it on a single row at every
font scale.
Surface the OEM charging-app telemetry on the home screen while a charge
or discharge session is active. Idle samples keep the original
RANGE / BATTERY line untouched.
Reads four extra read-only transactions from IVehicleChargingService:
getDischargingStatus (0x30), getActualChargingCurrent (0x07),
getPredictChargingTime (0x05), getPredictDischargingTime (0x29). The
gateway only issues these when charging or discharging is active so the
2-second dashboard poll stays cheap while idle.
The Sample model grows the new fields; existing call sites are
unchanged. A new ChargingStatus helper decodes the OEM enum values
(taken from the com.saicmotor.hmi.vehiclesettings resources) into
short labels matching the stock charging app wording.
DashboardGauges renders a two-line banner in the existing status
strip: 'CHARGING FAST/SLOW CHARGING' on the first line, the
instantaneous kW, current A, predicted minutes and ETA on the second.
Discharge uses 'DISCHARGING ...' with kW out. While the banner is
visible the title shimmers with a slow green (charging) or cyan
(discharging) gradient sweep; the animation stops and the shader is
cleared the moment the car goes idle.
buildUi() was only being re-run when UiTheme.version() changed, so toggling
the control-panel switch in SettingsActivity would leave the launcher
holding on to the previous home layout — the SETTINGS button that should
have appeared/disappeared stuck in whichever state it was rendered in
first. Rebuilding the home layout every resume (after applicationStarted)
is cheap and keeps the button visibility in sync with the latest prefs.
The behaviour was already correct (button rendered when the control
panel is off, hidden when it is on), but the comment was misleading
and the button used a fixed 118x48px size that didn't match the
panel's own SETTINGS button. Switched to dp units that line up with
the rest of the home screen chrome so the two SETTINGS buttons feel
like the same control.
The 38dp gear icon was getting clipped and went straight to the
control panel settings editor, which wasn't what the user expected.
* Header right-hand button is now a styled UiTheme "SETTINGS" text
button at full row height (38dp) and WRAP_CONTENT width so the
label is never truncated. Click opens the normal SettingsActivity
(the category hub) instead of the control-panel editor.
* The Settings shortcut tile inside the control panel now points at
ControlPanelSettingsActivity — that's where you reorder / add /
remove toggles and sliders, which is what an entry under the
CONTROL PANEL heading should reach.
Each slider now updates brightness / volume while the finger is on the
bar instead of only when the user lets go. A 50 ms coalescing handler
turns a stream of touch events into one MG-bridge / AudioManager call
every frame so the IPC traffic stays reasonable while the visual
feedback stays live. The onStopTrackingTouch callback flushes the
final value in case the last drag happened inside the debounce window.
Toggle icon refresh after enabling
- Bluetooth and Wi-Fi enable/disable is async on Android. Refreshing the
panel immediately after a successful toggle read the pre-toggle state
and left the icon coloured the wrong way. Schedule a refresh 600 ms
and 1400 ms after each successful toggle so the icon reflects the
real on/off state once the head unit settles.
Slider redesign
- Drop the slate box around each slider and the small icon/label row.
- The bar is now the visual element: a tall 64 dp blocky track with no
rounded corners.
- Label sits inside the cyan-filled portion on the left, the current
percent sits inside the dark unfilled portion on the right.
- The initial value is read via readSliderValue (MG service first, then
AudioManager) and applied to both the SeekBar progress and the
drawable's percent field before the first draw, so the bar shows the
real current level on render instead of starting at 0%.
- Sliders take 1/3 of the panel width, toggles take 2/3 so the owner
can place custom widgets and toggles in the wider area.
Home screen settings button
- Hide the top-right SETTINGS button on the home screen when the
swipe-down control panel is enabled.
- The control panel header now shows a small gear icon (\u2699) on the
right at the same height as the title, which opens the
ControlPanelSettingsActivity directly. Title text changes from
QUICK CONTROLS to CONTROL PANEL.
The official OEM Settings app passes 0x65 (VOL_FLAG_SETTINGS) as the
flag when invoking SmartSoundManager.setVolume, not 0x64
(VOL_FLAG_SYSTEM_UI). Matching that flag is what makes MG's volume
mixer actually accept our slider changes — the previous flag was
being silently ignored by the car audio manager.
The SAIC head-unit's brightness/volume/wifi/bluetooth are controlled
authoritatively by com.saicmotor.service.systemsettings (the
SettingsService), not the standard Android APIs. Calls through
AudioManager.setStreamVolume, Settings.System.SCREEN_BRIGHTNESS,
WifiManager.setWifiEnabled, and BluetoothAdapter.enable()/disable()
were no-ops (or crashed) on this unit.
* New MgServiceBridge talks raw IBinder to:
- IGeneralService for get/setBrightness (transaction codes 1, 3)
- ISmartSoundService for get/setVolume + getMax/getMin (0x28..0x2b)
- IWiFiService for get/setWifiEnabled (0x3, 0x4)
- IBtService for get/setBluetoothEnabled (0x2, 0x3)
* ControlPanelOverlay tries the MG bridge first; falls back to the
standard Android APIs when the head unit service isn't running.
* Adds CHANGE_WIFI_STATE, BLUETOOTH_ADMIN, BLUETOOTH_SCAN and
WRITE_SETTINGS permissions so the fallback paths also work.
* Adds OnConnectedListener so the panel re-renders as soon as a
service connects (avoids showing stale state).
* Ignore SetupWizardActivity.java which is a stale WIP file from
an earlier session that doesn't compile and isn't referenced.
- ControlPanelCatalog: drop auto_hold (no MG API), rename icon to iconKey
- ControlPanelOverlay: vector-drawn ControlIconView + circular ToggleRingView +
blocky BlockySliderDrawable to match official MG quick-control panel
- Bluetooth: request runtime BLUETOOTH_CONNECT on Android 12+, retry toggle after grant
- Wi-Fi: wrap setWifiEnabled in try/catch so head units that block it no longer crash
- Brightness: launch WRITE_SETTINGS permission intent when missing instead of crashing
- Volume sliders: catch SecurityException and surface a useful toast instead of failing silently
- Long-press on bluetooth/wifi tiles opens the system settings page
- App drawer and control panel are mutually exclusive in MainActivity.dispatchTouchEvent
- LauncherPins: add moveToIndex helper used by the new drag-to-reorder flow
- SettingsActivity: add Apps Reorder toggle, wiggle animation, full drag/drop reorder
- ControlPanelSettingsActivity: rename .icon references to .iconKey
Adds the app drawer (swipe-up) and the quick control panel (swipe-down) on the home screen, mirroring the official MG layout while staying on the existing theme.
Highlights
- App drawer overlay pins apps configured under Settings → Apps; opacity configurable in Settings (default 80%). Tap a tile to launch the pinned app, swipe up to open, swipe down to close.
- Control panel overlay opens on swipe-down and provides quick access controls. Preloaded with Brightness, Media/Phone/Voice volume sliders; Bluetooth, Wi-Fi, Autohold toggles (each toggle: tap to toggle state, long-press opens the matching settings page); plus Energy dashboard / Charging automation / Settings shortcuts.
- Control panel editor (ControlPanelSettingsActivity) lets users add/remove/reorder controls, and includes RESTORE DEFAULTS / ADD ALL / CLEAR actions.
- Removes toggles we cannot drive (vehicle hotspot, screen off, data traffic, door lock, ESC off) per user preference.
- Visual style matches the official MG control panel: rectangular/blocky sliders with custom track + progress (no thumb) and circular GradientDrawable.OVAL toggle tiles.
New feature: speed reactive audio (Settings > Misc). Pick an MP3 and a dedicated volume; the always-on trip tracker shifts the clip's pitch and playback rate from min to max speed while you drive. Loop-with-speed is the default; a toggle enables layered overlap so speed changes never cut the clip off.
Build script already compiles every module included in this commit.