App 2.16.2: show the car's screen size; display figures documented

The MG4's display is given as 1920x720 (this project), 1280x480
(EVProfile's README) and a 1778x720 app window (upstream). 1280x480 is
exactly 1920x720 px at 240 dpi expressed in dp, so the figures may
describe one panel at different densities, which this platform lets be
changed per app.

The Logs tab's new SCREEN line shows the panel's pixels and density and
the app window in px and dp, to settle it from the car. FIRMWARE.md
lists the three figures and what the emulator shows at 240 dpi;
mise.toml, README and SPECS.md no longer state 160 dpi as fact for the
car.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
This commit is contained in:
2026-10-18 19:50:24 +02:00
co-authored by Claude Opus 5.5
parent c2c0640672
commit bfa33d51bd
8 changed files with 47 additions and 6 deletions
@@ -263,6 +263,7 @@ public class MainActivity extends AppCompatActivity {
callLogText = logPane.findViewById(R.id.call_log_text);
steeringKeysText = logPane.findViewById(R.id.steering_keys_text);
TextView carColorText = logPane.findViewById(R.id.car_color_text);
showScreenInfo(logPane.findViewById(R.id.screen_text));
logPane.findViewById(R.id.car_color_button).setOnClickListener(v -> new Thread(() -> {
java.util.List<String> found = CarColorProbe.run(60);
String shown = found.isEmpty() ? getString(R.string.car_color_none)
@@ -289,6 +290,21 @@ public class MainActivity extends AppCompatActivity {
startForegroundService(new Intent(this, AbrpUploadService.class));
}
/**
* What the head unit reports about its screen, for the Logs tab: the panel in pixels and its
* density, and this app's window in pixels and in dp, which is what layouts are chosen by.
* Sources disagree on the MG4's numbers (1920×720, 1280×480, a 1778×720 window).
*/
@SuppressWarnings("deprecation") // getRealMetrics: the WindowMetrics API starts at 30; this is 28
private void showScreenInfo(TextView view) {
android.util.DisplayMetrics panel = new android.util.DisplayMetrics();
getWindowManager().getDefaultDisplay().getRealMetrics(panel);
android.util.DisplayMetrics window = getResources().getDisplayMetrics();
android.content.res.Configuration config = getResources().getConfiguration();
view.setText(getString(R.string.screen_info, panel.widthPixels, panel.heightPixels, panel.densityDpi,
window.widthPixels, window.heightPixels, config.screenWidthDp, config.screenHeightDp));
}
private static final String STATE_PAGE = "page";
@Override