Log the QR code payload length.

This commit is contained in:
akwizgran
2016-11-07 16:04:07 +00:00
parent 7c3805260d
commit 7327029fca

View File

@@ -57,6 +57,7 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
import static android.view.View.INVISIBLE; import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE; import static android.view.View.VISIBLE;
import static android.widget.Toast.LENGTH_LONG; import static android.widget.Toast.LENGTH_LONG;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING; import static java.util.logging.Level.WARNING;
public class ShowQrCodeFragment extends BaseEventFragment public class ShowQrCodeFragment extends BaseEventFragment
@@ -244,8 +245,10 @@ public class ShowQrCodeFragment extends BaseEventFragment
@UiThread @UiThread
private void qrCodeScanned(String content) { private void qrCodeScanned(String content) {
try { try {
Payload remotePayload = payloadParser.parse( byte[] encoded = Base64.decode(content, 0);
Base64.decode(content, 0)); if (LOG.isLoggable(INFO))
LOG.info("Remote payload is " + encoded.length + " bytes");
Payload remotePayload = payloadParser.parse(encoded);
cameraView.setVisibility(INVISIBLE); cameraView.setVisibility(INVISIBLE);
statusView.setVisibility(VISIBLE); statusView.setVisibility(VISIBLE);
status.setText(R.string.connecting_to_device); status.setText(R.string.connecting_to_device);
@@ -293,9 +296,10 @@ public class ShowQrCodeFragment extends BaseEventFragment
@Override @Override
protected Bitmap doInBackground(Void... params) { protected Bitmap doInBackground(Void... params) {
String input = byte[] encoded = payloadEncoder.encode(payload);
Base64.encodeToString(payloadEncoder.encode(payload), if (LOG.isLoggable(INFO))
0); LOG.info("Local payload is " + encoded.length + " bytes");
String input = Base64.encodeToString(encoded, 0);
return QrCodeUtils.createQrCode(dm, input); return QrCodeUtils.createQrCode(dm, input);
} }