From 00c8b534cd9e2235ea543c4f5835737ac2fa2786 Mon Sep 17 00:00:00 2001 From: Arc Wang Date: Wed, 19 Jun 2019 10:01:17 +0800 Subject: [PATCH] [Wi-Fi DPP] Wi-Fi QR code scanner is not working after a connection fail After a user uses Wi-Fi QR code scanner to scan a QR code of an unreachable Wi-Fi network, the scanner does not recognize any QR code until the scanner is restarted or back from a screen off state. To restart QrCamera after a Wi-Fi QR code recognition, we should stop it before start, otherwise the DecodeTask will not work. Bug: 135225856 Test: Scan a Wi-Fi QR code of unreachable Wi-Fi network and scan a Wi-Fi QR code of reachable Wi-Fi network, check if the scanner recognizes QR code. Change-Id: I0063c867d8e4046f184d02134bda842887c003a1 --- .../settings/wifi/dpp/WifiDppQrCodeScannerFragment.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java index e915069d05c..d595f793fe8 100644 --- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java +++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java @@ -686,6 +686,10 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl return; } + if (mCamera.isDecodeTaskAlive()) { + mCamera.stop(); + } + final SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture(); if (surfaceTexture == null) { throw new IllegalStateException("SurfaceTexture is not ready for restarting camera");