mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
One more time -- rationalize log levels, mostly downward, and pull out 1-2 more statements
git-svn-id: https://zxing.googlecode.com/svn/trunk@1342 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
3ca1966aa2
commit
0e7aedd046
|
@ -672,7 +672,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// Barcode Scanner has seen crashes in the wild of this variety:
|
// Barcode Scanner has seen crashes in the wild of this variety:
|
||||||
// java.?lang.?RuntimeException: Fail to connect to camera service
|
// java.?lang.?RuntimeException: Fail to connect to camera service
|
||||||
Log.e(TAG, e.toString());
|
Log.w(TAG, "Unexpected error initializating camera", e);
|
||||||
displayFrameworkBugMessageAndExit();
|
displayFrameworkBugMessageAndExit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ public final class CaptureActivityHandler extends Handler {
|
||||||
public void handleMessage(Message message) {
|
public void handleMessage(Message message) {
|
||||||
switch (message.what) {
|
switch (message.what) {
|
||||||
case R.id.auto_focus:
|
case R.id.auto_focus:
|
||||||
Log.v(TAG, "Got auto-focus message");
|
//Log.d(TAG, "Got auto-focus message");
|
||||||
// When one auto focus pass finishes, start another. This is the closest thing to
|
// When one auto focus pass finishes, start another. This is the closest thing to
|
||||||
// continuous AF. It does seem to hunt a bit, but I'm not sure what else to do.
|
// continuous AF. It does seem to hunt a bit, but I'm not sure what else to do.
|
||||||
if (state == State.PREVIEW) {
|
if (state == State.PREVIEW) {
|
||||||
|
@ -79,11 +79,11 @@ public final class CaptureActivityHandler extends Handler {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.restart_preview:
|
case R.id.restart_preview:
|
||||||
Log.v(TAG, "Got restart preview message");
|
Log.d(TAG, "Got restart preview message");
|
||||||
restartPreviewAndDecode();
|
restartPreviewAndDecode();
|
||||||
break;
|
break;
|
||||||
case R.id.decode_succeeded:
|
case R.id.decode_succeeded:
|
||||||
Log.v(TAG, "Got decode succeeded message");
|
Log.d(TAG, "Got decode succeeded message");
|
||||||
state = State.SUCCESS;
|
state = State.SUCCESS;
|
||||||
Bundle bundle = message.getData();
|
Bundle bundle = message.getData();
|
||||||
Bitmap barcode = bundle == null ? null : (Bitmap) bundle.getParcelable(DecodeThread.BARCODE_BITMAP);
|
Bitmap barcode = bundle == null ? null : (Bitmap) bundle.getParcelable(DecodeThread.BARCODE_BITMAP);
|
||||||
|
@ -95,12 +95,12 @@ public final class CaptureActivityHandler extends Handler {
|
||||||
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
|
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
|
||||||
break;
|
break;
|
||||||
case R.id.return_scan_result:
|
case R.id.return_scan_result:
|
||||||
Log.v(TAG, "Got return scan result message");
|
Log.d(TAG, "Got return scan result message");
|
||||||
activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
|
activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
|
||||||
activity.finish();
|
activity.finish();
|
||||||
break;
|
break;
|
||||||
case R.id.launch_product_query:
|
case R.id.launch_product_query:
|
||||||
Log.v(TAG, "Got product query message");
|
Log.d(TAG, "Got product query message");
|
||||||
String url = (String) message.obj;
|
String url = (String) message.obj;
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||||
|
|
|
@ -49,7 +49,7 @@ final class DecodeHandler extends Handler {
|
||||||
public void handleMessage(Message message) {
|
public void handleMessage(Message message) {
|
||||||
switch (message.what) {
|
switch (message.what) {
|
||||||
case R.id.decode:
|
case R.id.decode:
|
||||||
Log.v(TAG, "Got decode message");
|
//Log.d(TAG, "Got decode message");
|
||||||
decode((byte[]) message.obj, message.arg1, message.arg2);
|
decode((byte[]) message.obj, message.arg1, message.arg2);
|
||||||
break;
|
break;
|
||||||
case R.id.quit:
|
case R.id.quit:
|
||||||
|
@ -81,12 +81,12 @@ final class DecodeHandler extends Handler {
|
||||||
|
|
||||||
if (rawResult != null) {
|
if (rawResult != null) {
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
Log.v(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString());
|
Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString());
|
||||||
Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult);
|
Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult);
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putParcelable(DecodeThread.BARCODE_BITMAP, source.renderCroppedGreyscaleBitmap());
|
bundle.putParcelable(DecodeThread.BARCODE_BITMAP, source.renderCroppedGreyscaleBitmap());
|
||||||
message.setData(bundle);
|
message.setData(bundle);
|
||||||
Log.v(TAG, "Sending decode succeeded message...");
|
//Log.d(TAG, "Sending decode succeeded message...");
|
||||||
message.sendToTarget();
|
message.sendToTarget();
|
||||||
} else {
|
} else {
|
||||||
Message message = Message.obtain(activity.getHandler(), R.id.decode_failed);
|
Message message = Message.obtain(activity.getHandler(), R.id.decode_failed);
|
||||||
|
|
|
@ -209,7 +209,7 @@ public final class SearchBookContentsActivity extends Activity {
|
||||||
resultListView.setAdapter(null);
|
resultListView.setAdapter(null);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
Log.e(TAG, e.toString());
|
Log.w(TAG, "Bad JSON from book search", e);
|
||||||
resultListView.setAdapter(null);
|
resultListView.setAdapter(null);
|
||||||
headerView.setText(R.string.msg_sbc_failed);
|
headerView.setText(R.string.msg_sbc_failed);
|
||||||
}
|
}
|
||||||
|
@ -291,12 +291,12 @@ public final class SearchBookContentsActivity extends Activity {
|
||||||
message.obj = json;
|
message.obj = json;
|
||||||
message.sendToTarget();
|
message.sendToTarget();
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "HTTP returned " + response.getStatusLine().getStatusCode() + " for " + uri);
|
Log.w(TAG, "HTTP returned " + response.getStatusLine().getStatusCode() + " for " + uri);
|
||||||
Message message = Message.obtain(handler, R.id.search_book_contents_failed);
|
Message message = Message.obtain(handler, R.id.search_book_contents_failed);
|
||||||
message.sendToTarget();
|
message.sendToTarget();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, e.toString());
|
Log.w(TAG, "Error accessing book search", e);
|
||||||
Message message = Message.obtain(handler, R.id.search_book_contents_failed);
|
Message message = Message.obtain(handler, R.id.search_book_contents_failed);
|
||||||
message.sendToTarget();
|
message.sendToTarget();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -312,7 +312,7 @@ public final class SearchBookContentsActivity extends Activity {
|
||||||
private static String getCookie(String url) {
|
private static String getCookie(String url) {
|
||||||
String cookie = CookieManager.getInstance().getCookie(url);
|
String cookie = CookieManager.getInstance().getCookie(url);
|
||||||
if (cookie == null || cookie.length() == 0) {
|
if (cookie == null || cookie.length() == 0) {
|
||||||
Log.v(TAG, "Book Search cookie was missing or expired");
|
Log.d(TAG, "Book Search cookie was missing or expired");
|
||||||
HttpUriRequest head = new HttpHead(url);
|
HttpUriRequest head = new HttpHead(url);
|
||||||
AndroidHttpClient client = AndroidHttpClient.newInstance(USER_AGENT);
|
AndroidHttpClient client = AndroidHttpClient.newInstance(USER_AGENT);
|
||||||
try {
|
try {
|
||||||
|
@ -326,7 +326,7 @@ public final class SearchBookContentsActivity extends Activity {
|
||||||
cookie = CookieManager.getInstance().getCookie(url);
|
cookie = CookieManager.getInstance().getCookie(url);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, e.toString());
|
Log.w(TAG, "Error setting book search cookie", e);
|
||||||
}
|
}
|
||||||
client.close();
|
client.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ final class AutoFocusCallback implements Camera.AutoFocusCallback {
|
||||||
Message message = autoFocusHandler.obtainMessage(autoFocusMessage, success);
|
Message message = autoFocusHandler.obtainMessage(autoFocusMessage, success);
|
||||||
// Simulate continuous autofocus by sending a focus request every
|
// Simulate continuous autofocus by sending a focus request every
|
||||||
// AUTOFOCUS_INTERVAL_MS milliseconds.
|
// AUTOFOCUS_INTERVAL_MS milliseconds.
|
||||||
Log.v(TAG, "Got auto-focus callback; requesting another");
|
//Log.d(TAG, "Got auto-focus callback; requesting another");
|
||||||
autoFocusHandler.sendMessageDelayed(message, AUTOFOCUS_INTERVAL_MS);
|
autoFocusHandler.sendMessageDelayed(message, AUTOFOCUS_INTERVAL_MS);
|
||||||
autoFocusHandler = null;
|
autoFocusHandler = null;
|
||||||
if (!reinitCamera) {
|
if (!reinitCamera) {
|
||||||
|
@ -54,7 +54,7 @@ final class AutoFocusCallback implements Camera.AutoFocusCallback {
|
||||||
configManager.setDesiredCameraParameters(camera);
|
configManager.setDesiredCameraParameters(camera);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "Got auto-focus callback, but no handler for it");
|
Log.d(TAG, "Got auto-focus callback, but no handler for it");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,13 +52,13 @@ final class CameraConfigurationManager {
|
||||||
Camera.Parameters parameters = camera.getParameters();
|
Camera.Parameters parameters = camera.getParameters();
|
||||||
previewFormat = parameters.getPreviewFormat();
|
previewFormat = parameters.getPreviewFormat();
|
||||||
previewFormatString = parameters.get("preview-format");
|
previewFormatString = parameters.get("preview-format");
|
||||||
Log.v(TAG, "Default preview format: " + previewFormat + '/' + previewFormatString);
|
Log.d(TAG, "Default preview format: " + previewFormat + '/' + previewFormatString);
|
||||||
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||||
Display display = manager.getDefaultDisplay();
|
Display display = manager.getDefaultDisplay();
|
||||||
screenResolution = new Point(display.getWidth(), display.getHeight());
|
screenResolution = new Point(display.getWidth(), display.getHeight());
|
||||||
Log.v(TAG, "Screen resolution: " + screenResolution);
|
Log.d(TAG, "Screen resolution: " + screenResolution);
|
||||||
cameraResolution = getCameraResolution(parameters, screenResolution);
|
cameraResolution = getCameraResolution(parameters, screenResolution);
|
||||||
Log.v(TAG, "Camera resolution: " + screenResolution);
|
Log.d(TAG, "Camera resolution: " + screenResolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +69,7 @@ final class CameraConfigurationManager {
|
||||||
*/
|
*/
|
||||||
void setDesiredCameraParameters(Camera camera) {
|
void setDesiredCameraParameters(Camera camera) {
|
||||||
Camera.Parameters parameters = camera.getParameters();
|
Camera.Parameters parameters = camera.getParameters();
|
||||||
Log.v(TAG, "Setting preview size: " + cameraResolution);
|
Log.d(TAG, "Setting preview size: " + cameraResolution);
|
||||||
parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
|
parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
|
||||||
setFlash(parameters);
|
setFlash(parameters);
|
||||||
setZoom(parameters);
|
setZoom(parameters);
|
||||||
|
@ -104,7 +104,7 @@ final class CameraConfigurationManager {
|
||||||
Point cameraResolution = null;
|
Point cameraResolution = null;
|
||||||
|
|
||||||
if (previewSizeValueString != null) {
|
if (previewSizeValueString != null) {
|
||||||
Log.v(TAG, "preview-size-values parameter: " + previewSizeValueString);
|
Log.d(TAG, "preview-size-values parameter: " + previewSizeValueString);
|
||||||
cameraResolution = findBestPreviewSizeValue(previewSizeValueString, screenResolution);
|
cameraResolution = findBestPreviewSizeValue(previewSizeValueString, screenResolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ public final class CameraManager {
|
||||||
public void requestAutoFocus(Handler handler, int message) {
|
public void requestAutoFocus(Handler handler, int message) {
|
||||||
if (camera != null && previewing) {
|
if (camera != null && previewing) {
|
||||||
autoFocusCallback.setHandler(handler, message);
|
autoFocusCallback.setHandler(handler, message);
|
||||||
Log.v(TAG, "Requesting auto-focus callback");
|
//Log.d(TAG, "Requesting auto-focus callback");
|
||||||
camera.autoFocus(autoFocusCallback);
|
camera.autoFocus(autoFocusCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ public final class CameraManager {
|
||||||
int leftOffset = (screenResolution.x - width) / 2;
|
int leftOffset = (screenResolution.x - width) / 2;
|
||||||
int topOffset = (screenResolution.y - height) / 2;
|
int topOffset = (screenResolution.y - height) / 2;
|
||||||
framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
|
framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
|
||||||
Log.v(TAG, "Calculated framing rect: " + framingRect);
|
Log.d(TAG, "Calculated framing rect: " + framingRect);
|
||||||
}
|
}
|
||||||
return framingRect;
|
return framingRect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,9 +44,9 @@ final class FlashlightManager {
|
||||||
iHardwareService = getHardwareService();
|
iHardwareService = getHardwareService();
|
||||||
setFlashEnabledMethod = getSetFlashEnabledMethod(iHardwareService);
|
setFlashEnabledMethod = getSetFlashEnabledMethod(iHardwareService);
|
||||||
if (iHardwareService == null) {
|
if (iHardwareService == null) {
|
||||||
Log.i(TAG, "This device does supports control of a flashlight");
|
Log.v(TAG, "This device does supports control of a flashlight");
|
||||||
} else {
|
} else {
|
||||||
Log.i(TAG, "This device does not support control of a flashlight");
|
Log.v(TAG, "This device does not support control of a flashlight");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ final class PreviewCallback implements Camera.PreviewCallback {
|
||||||
message.sendToTarget();
|
message.sendToTarget();
|
||||||
previewHandler = null;
|
previewHandler = null;
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "Got preview callback, but no handler for it");
|
Log.d(TAG, "Got preview callback, but no handler for it");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,14 +161,14 @@ public final class EncodeActivity extends Activity {
|
||||||
bitmap = QRCodeEncoder.encodeAsBitmap(contents, BarcodeFormat.QR_CODE,
|
bitmap = QRCodeEncoder.encodeAsBitmap(contents, BarcodeFormat.QR_CODE,
|
||||||
SHARE_BARCODE_DIMENSION, SHARE_BARCODE_DIMENSION);
|
SHARE_BARCODE_DIMENSION, SHARE_BARCODE_DIMENSION);
|
||||||
} catch (WriterException we) {
|
} catch (WriterException we) {
|
||||||
Log.w(TAG, we.toString());
|
Log.w(TAG, we);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
File bsRoot = new File(Environment.getExternalStorageDirectory(), "BarcodeScanner");
|
File bsRoot = new File(Environment.getExternalStorageDirectory(), "BarcodeScanner");
|
||||||
File barcodesRoot = new File(bsRoot, "Barcodes");
|
File barcodesRoot = new File(bsRoot, "Barcodes");
|
||||||
if (!barcodesRoot.exists() && !barcodesRoot.mkdirs()) {
|
if (!barcodesRoot.exists() && !barcodesRoot.mkdirs()) {
|
||||||
Log.v(TAG, "Couldn't make dir " + barcodesRoot);
|
Log.w(TAG, "Couldn't make dir " + barcodesRoot);
|
||||||
showErrorMessage(R.string.msg_unmount_usb);
|
showErrorMessage(R.string.msg_unmount_usb);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ public final class EncodeActivity extends Activity {
|
||||||
fos = new FileOutputStream(barcodeFile);
|
fos = new FileOutputStream(barcodeFile);
|
||||||
bitmap.compress(Bitmap.CompressFormat.PNG, 0, fos);
|
bitmap.compress(Bitmap.CompressFormat.PNG, 0, fos);
|
||||||
} catch (FileNotFoundException fnfe) {
|
} catch (FileNotFoundException fnfe) {
|
||||||
Log.v(TAG, "Couldn't access file " + barcodeFile + " due to " + fnfe);
|
Log.w(TAG, "Couldn't access file " + barcodeFile + " due to " + fnfe);
|
||||||
showErrorMessage(R.string.msg_unmount_usb);
|
showErrorMessage(R.string.msg_unmount_usb);
|
||||||
return true;
|
return true;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -351,11 +351,11 @@ final class QRCodeEncoder {
|
||||||
message.obj = bitmap;
|
message.obj = bitmap;
|
||||||
message.sendToTarget();
|
message.sendToTarget();
|
||||||
} catch (WriterException e) {
|
} catch (WriterException e) {
|
||||||
Log.e(TAG, e.toString());
|
Log.e(TAG, "Could not encode barcode", e);
|
||||||
Message message = Message.obtain(handler, R.id.encode_failed);
|
Message message = Message.obtain(handler, R.id.encode_failed);
|
||||||
message.sendToTarget();
|
message.sendToTarget();
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.e(TAG, e.toString());
|
Log.e(TAG, "Could not encode barcode", e);
|
||||||
Message message = Message.obtain(handler, R.id.encode_failed);
|
Message message = Message.obtain(handler, R.id.encode_failed);
|
||||||
message.sendToTarget();
|
message.sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,7 @@ public final class HistoryManager {
|
||||||
File bsRoot = new File(Environment.getExternalStorageDirectory(), "BarcodeScanner");
|
File bsRoot = new File(Environment.getExternalStorageDirectory(), "BarcodeScanner");
|
||||||
File historyRoot = new File(bsRoot, "History");
|
File historyRoot = new File(bsRoot, "History");
|
||||||
if (!historyRoot.exists() && !historyRoot.mkdirs()) {
|
if (!historyRoot.exists() && !historyRoot.mkdirs()) {
|
||||||
Log.v(TAG, "Couldn't make dir " + historyRoot);
|
Log.w(TAG, "Couldn't make dir " + historyRoot);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
File historyFile = new File(historyRoot, "history-" + System.currentTimeMillis() + ".csv");
|
File historyFile = new File(historyRoot, "history-" + System.currentTimeMillis() + ".csv");
|
||||||
|
@ -232,7 +232,7 @@ public final class HistoryManager {
|
||||||
out.write(history);
|
out.write(history);
|
||||||
return Uri.parse("file://" + historyFile.getAbsolutePath());
|
return Uri.parse("file://" + historyFile.getAbsolutePath());
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.v(TAG, "Couldn't access file " + historyFile + " due to " + ioe);
|
Log.w(TAG, "Couldn't access file " + historyFile + " due to " + ioe);
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
|
|
Loading…
Reference in a new issue