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
+2 -2
View File
@@ -34,8 +34,8 @@ android {
applicationId "com.stinnesbeck.nilsmg4"
minSdk 27
targetSdk 36
versionCode 85
versionName "2.16.1"
versionCode 86
versionName "2.16.2"
// Nothing about the server ships in the APK: its URL and ingest token are entered in
// the app's Server tab (ServerConfig), and the database is only reachable by the server.
@@ -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
+2
View File
@@ -11,5 +11,7 @@
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:text="@string/hint_car_color" android:textAppearance="@style/Text.EV.Secondary" />
<com.google.android.material.button.MaterialButton android:id="@+id/car_color_button" style="@style/Widget.EV.Button.Outlined" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="12dp" android:text="@string/btn_car_color" />
<TextView android:id="@+id/car_color_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="12dp" android:textAppearance="@style/Text.EV.Body" android:fontFamily="monospace" android:textSize="14sp" android:lineSpacingExtra="4dp" android:textIsSelectable="true" />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="32dp" android:text="@string/label_screen" android:textAppearance="@style/Text.EV.Eyebrow" />
<TextView android:id="@+id/screen_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:text="@string/no_value" android:textAppearance="@style/Text.EV.Body" android:fontFamily="monospace" android:textSize="14sp" android:textIsSelectable="true" />
</LinearLayout>
</com.evsuite.abrp.StableScrollView>
+2
View File
@@ -40,6 +40,8 @@
<string name="power_waiting">needs a minute of data</string>
<string name="label_tire_unit">Tyre pressure unit</string>
<string name="label_accent">Accent colour</string>
<string name="label_screen">SCREEN</string>
<string name="screen_info">Panel %1$d × %2$d px at %3$d dpi\nApp window %4$d × %5$d px = %6$d × %7$d dp</string>
<string name="label_car_color">CAR COLOUR</string>
<string name="hint_car_color">Lists the head unit\'s settings that mention a colour, paint or car model, to find out whether the car\'s colour can be read. A photo of this list helps.</string>
<string name="btn_car_color">Look for the car colour</string>