App 2.7.1: voice-key double press works; floating button removed
The car's key report, from the on-screen key log in 2.7.0: android.intent.extra.hardkey.keycode = 287 (Integer), android.intent.extra.hardkey.down (Boolean; one report on press, one on release) and android.intent.extra.hardkey.longpress (Boolean). 2.7.0 only looked for short names like "keyCode", so it never found the code. SteeringKeyReport now matches extras by the last part of their name, case-insensitively, and is Android-free; its tests include the exact double press logged on the car (releases 279 ms apart). Replayed in the car's format on the emulator: double press opens the app, single and long presses do not. The floating button is removed (class, geometry and test, the overlay permission, setting, switch and strings): it did not show over the MG4 launcher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
This commit is contained in:
@@ -120,9 +120,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
private TextView connectionStatusText;
|
||||
|
||||
/** Upload page: live telemetry switch and cadence. */
|
||||
private SwitchMaterial liveTelemetrySwitch, boostSwitch, floatingButtonSwitch, voiceKeySwitch;
|
||||
private SwitchMaterial liveTelemetrySwitch, boostSwitch, voiceKeySwitch;
|
||||
private TextView steeringKeysText;
|
||||
private View overlayPermissionNote;
|
||||
private android.widget.Spinner intervalSpinner;
|
||||
private TextInputLayout lowSocLayout;
|
||||
private TextInputEditText lowSocInput;
|
||||
@@ -307,8 +306,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
super.onResume();
|
||||
// Poll state and log only while the screen is up; onPause cancels it.
|
||||
uiHandler.post(uiRefresh);
|
||||
FloatingButton.setAppInForeground(true);
|
||||
refreshOverlayPermissionNote();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -316,7 +313,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
super.onPause();
|
||||
// Stop polling off-screen: this activity has no reason to spend cycles then.
|
||||
uiHandler.removeCallbacks(uiRefresh);
|
||||
FloatingButton.setAppInForeground(false);
|
||||
}
|
||||
|
||||
// ---------- Update check ----------
|
||||
@@ -802,22 +798,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
voiceKeySwitch.setChecked(UploadSettings.voiceKeyOpensApp(prefs));
|
||||
voiceKeySwitch.setOnCheckedChangeListener((btn, checked) ->
|
||||
prefs.edit().putBoolean(UploadSettings.KEY_VOICE_KEY_OPENS, checked).apply());
|
||||
floatingButtonSwitch = servicePane.findViewById(R.id.floating_button_switch);
|
||||
overlayPermissionNote = servicePane.findViewById(R.id.overlay_permission_note);
|
||||
floatingButtonSwitch.setChecked(UploadSettings.floatingButtonEnabled(prefs));
|
||||
floatingButtonSwitch.setOnCheckedChangeListener((btn, checked) -> {
|
||||
prefs.edit().putBoolean(UploadSettings.KEY_FLOATING_BUTTON, checked).apply();
|
||||
FloatingButton.refresh();
|
||||
refreshOverlayPermissionNote();
|
||||
});
|
||||
servicePane.findViewById(R.id.overlay_permission_button).setOnClickListener(v -> {
|
||||
try {
|
||||
startActivity(new Intent(android.provider.Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||
Uri.parse("package:" + getPackageName())));
|
||||
} catch (android.content.ActivityNotFoundException e) {
|
||||
Toast.makeText(this, R.string.overlay_settings_missing, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
liveTelemetrySwitch = servicePane.findViewById(R.id.abrp_upload_switch);
|
||||
intervalSpinner = servicePane.findViewById(R.id.interval_spinner);
|
||||
boostSwitch = servicePane.findViewById(R.id.boost_switch);
|
||||
@@ -874,16 +854,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The note under the floating-button switch: only when the button is wanted but this build
|
||||
* may not draw over other apps (the car build may, through the system UID).
|
||||
*/
|
||||
private void refreshOverlayPermissionNote() {
|
||||
if (overlayPermissionNote == null) return;
|
||||
boolean missing = UploadSettings.floatingButtonEnabled(prefs) && !FloatingButton.canDraw(this);
|
||||
overlayPermissionNote.setVisibility(missing ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
/** Clamped to 1-99: 0 would never trigger and 100 would boost permanently. */
|
||||
private void saveLowSocThreshold() {
|
||||
CharSequence raw = lowSocInput.getText();
|
||||
|
||||
Reference in New Issue
Block a user