What changed, and why it matters
This commit adjusts the Android QR code scanner screen so its buttons and text don't get hidden behind the phone's status bar or navigation gestures on newer Android versions (Android 15+). It is a user-interface compatibility fix, not a security patch.
No security action needed. Treat as a normal UI/layout compatibility update.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change adds edge-to-edge (e2e) insets handling to SimpleScannerActivity.java. For Android API 35+ it listens for WindowInsets and applies system-bar padding to the content frame, top padding to the hint TextView, and bottom margin to the paste Button. No security-sensitive logic, permissions, network, or crypto code is modified.
Changed components
electrum/gui/qml/java_classes/org/electrum/qr/SimpleScannerActivity.javaInspect captured patch +50 / −0
diff --git a/electrum/gui/qml/java_classes/org/electrum/qr/SimpleScannerActivity.java b/electrum/gui/qml/java_classes/org/electrum/qr/SimpleScannerActivity.java
index 58eeeb8..d6db097 100644
--- a/electrum/gui/qml/java_classes/org/electrum/qr/SimpleScannerActivity.java
+++ b/electrum/gui/qml/java_classes/org/electrum/qr/SimpleScannerActivity.java
@@ -2,6 +2,7 @@ package org.electrum.qr;
import android.app.Activity;
import android.os.Bundle;
+import android.os.Build;
import android.util.Log;
import android.content.Intent;
import android.Manifest;
@@ -12,6 +13,7 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.view.View;
import android.view.ViewGroup;
+import android.view.WindowInsets;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
@@ -68,6 +70,7 @@ public class SimpleScannerActivity extends Activity {
}
}
});
+ setupEdgeToEdge();
}
@Override
@@ -156,4 +159,51 @@ public class SimpleScannerActivity extends Activity {
}
}
+ private boolean enforcesEdgeToEdge() {
+ // if true the UI needs to be padded to be e2e compatible
+ return Build.VERSION.SDK_INT >= 35;
+ }
+
+ private void setupEdgeToEdge() {
+ if (!enforcesEdgeToEdge()) {
+ return;
+ }
+
+ // Get the root view and set up insets listener
+ getWindow().getDecorView().setOnApplyWindowInsetsListener((v, insets) -> {
+ android.graphics.Insets systemBars = insets.getInsets(WindowInsets.Type.systemBars());
+
+ // Apply padding to content frame to keep scanner focus area centered
+ ViewGroup contentFrame = findViewById(R.id.content_frame);
+ if (contentFrame != null) {
+ contentFrame.setPadding(
+ systemBars.left,
+ systemBars.top,
+ systemBars.right,
+ systemBars.bottom
+ );
+ }
+
+ // Apply top padding to hint text for status bar
+ TextView hintTextView = findViewById(R.id.hint);
+ if (hintTextView != null) {
+ hintTextView.setPadding(
+ hintTextView.getPaddingLeft(),
+ systemBars.top,
+ hintTextView.getPaddingRight(),
+ hintTextView.getPaddingBottom()
+ );
+ }
+
+ // Apply bottom margin to paste button for navigation bar
+ Button pasteButton = findViewById(R.id.paste_btn);
+ if (pasteButton != null) {
+ ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) pasteButton.getLayoutParams();
+ params.bottomMargin = systemBars.bottom;
+ pasteButton.setLayoutParams(params);
+ }
+
+ return insets;
+ });
+ }
}
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.