[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
This commit is contained in:
Arc Wang
2019-06-19 10:01:17 +08:00
parent 7d43125964
commit 00c8b534cd

View File

@@ -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");