Fix blurry camera during QR scanning on multi-camera devices
Camera never focuses when scanning QR codes on devices with multiple back cameras (e.g., HMD Skyline on Android 15). The zxing library's default autofocus mode doesn't work reliably on these devices.
Changes
- Configure
CameraSettings.FocusMode.CONTINUOUSfor barcode scanner camera in both QR scanning entry points:-
QrScanFragment.java(used byQrActivity) -
RegistrationQrActivity.java(used for second device setup)
-
CameraSettings settings = barcodeScannerView.getBarcodeView().getCameraSettings();
settings.setFocusMode(CameraSettings.FocusMode.CONTINUOUS);
barcodeScannerView.getBarcodeView().setCameraSettings(settings);
Continuous autofocus keeps adjusting focus as the scene changes, which is more reliable than single-shot autofocus on multi-camera systems.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dl.google.com
- Triggering command:
/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx4608m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/lib/gradle-daemon-main-8.13.jar(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
Original prompt
This section details on the original issue you should resolve
<issue_title>Blurr image while scanning QR</issue_title> <issue_description>
- Android version:15
- Device: HMD Skyline
- ArcaneChat version:2.11.0
- Expected behavior: the camera image is focused
- Actual behavior: the camera image never comes into focus
- Steps to reproduce the problem: try to add a second device
- Screenshots:
![]()
</issue_description>
Comments on the Issue (you are @copilot in this section)
@adbenitez that sounds like a problem of your camera ð¤@adbenitez the back camera is used, and if you meant there are 3 in the back that is up to the system, maybe try cleaning them ð@adbenitez could you try with this QR scanning app: https://f-droid.org/en/packages/com.example.barcodescanner/thanks in advance</comment_new> <comment_new>
ok so probably it is a problem with the QR library we use, sadly IIRC we can't upgrade it without having to drop support for android 5</comment_new> <comment_new>@adbenitez @adbenitez more than for your particular device ð sorrybut eventually it will get dropped when there are less remain android 5 users</comment_new>
- Fixes ArcaneChat/android#53
ð¡ You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.