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:
srowen 2010-05-07 08:07:39 +00:00
parent 3ca1966aa2
commit 0e7aedd046
12 changed files with 33 additions and 33 deletions

View file

@ -672,7 +672,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
} catch (RuntimeException e) {
// Barcode Scanner has seen crashes in the wild of this variety:
// java.?lang.?RuntimeException: Fail to connect to camera service
Log.e(TAG, e.toString());
Log.w(TAG, "Unexpected error initializating camera", e);
displayFrameworkBugMessageAndExit();
return;
}

View file

@ -71,7 +71,7 @@ public final class CaptureActivityHandler extends Handler {
public void handleMessage(Message message) {
switch (message.what) {
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
// continuous AF. It does seem to hunt a bit, but I'm not sure what else to do.
if (state == State.PREVIEW) {
@ -79,11 +79,11 @@ public final class CaptureActivityHandler extends Handler {
}
break;
case R.id.restart_preview:
Log.v(TAG, "Got restart preview message");
Log.d(TAG, "Got restart preview message");
restartPreviewAndDecode();
break;
case R.id.decode_succeeded:
Log.v(TAG, "Got decode succeeded message");
Log.d(TAG, "Got decode succeeded message");
state = State.SUCCESS;
Bundle bundle = message.getData();
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);
break;
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.finish();
break;
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;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);

View file

@ -49,7 +49,7 @@ final class DecodeHandler extends Handler {
public void handleMessage(Message message) {
switch (message.what) {
case R.id.decode:
Log.v(TAG, "Got decode message");
//Log.d(TAG, "Got decode message");
decode((byte[]) message.obj, message.arg1, message.arg2);
break;
case R.id.quit:
@ -81,12 +81,12 @@ final class DecodeHandler extends Handler {
if (rawResult != null) {
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);
Bundle bundle = new Bundle();
bundle.putParcelable(DecodeThread.BARCODE_BITMAP, source.renderCroppedGreyscaleBitmap());
message.setData(bundle);
Log.v(TAG, "Sending decode succeeded message...");
//Log.d(TAG, "Sending decode succeeded message...");
message.sendToTarget();
} else {
Message message = Message.obtain(activity.getHandler(), R.id.decode_failed);

View file

@ -209,7 +209,7 @@ public final class SearchBookContentsActivity extends Activity {
resultListView.setAdapter(null);
}
} catch (JSONException e) {
Log.e(TAG, e.toString());
Log.w(TAG, "Bad JSON from book search", e);
resultListView.setAdapter(null);
headerView.setText(R.string.msg_sbc_failed);
}
@ -291,12 +291,12 @@ public final class SearchBookContentsActivity extends Activity {
message.obj = json;
message.sendToTarget();
} 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.sendToTarget();
}
} 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.sendToTarget();
} finally {
@ -312,7 +312,7 @@ public final class SearchBookContentsActivity extends Activity {
private static String getCookie(String url) {
String cookie = CookieManager.getInstance().getCookie(url);
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);
AndroidHttpClient client = AndroidHttpClient.newInstance(USER_AGENT);
try {
@ -326,7 +326,7 @@ public final class SearchBookContentsActivity extends Activity {
cookie = CookieManager.getInstance().getCookie(url);
}
} catch (IOException e) {
Log.e(TAG, e.toString());
Log.w(TAG, "Error setting book search cookie", e);
}
client.close();
}

View file

@ -46,7 +46,7 @@ final class AutoFocusCallback implements Camera.AutoFocusCallback {
Message message = autoFocusHandler.obtainMessage(autoFocusMessage, success);
// Simulate continuous autofocus by sending a focus request every
// 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 = null;
if (!reinitCamera) {
@ -54,7 +54,7 @@ final class AutoFocusCallback implements Camera.AutoFocusCallback {
configManager.setDesiredCameraParameters(camera);
}
} 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");
}
}

View file

@ -52,13 +52,13 @@ final class CameraConfigurationManager {
Camera.Parameters parameters = camera.getParameters();
previewFormat = parameters.getPreviewFormat();
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);
Display display = manager.getDefaultDisplay();
screenResolution = new Point(display.getWidth(), display.getHeight());
Log.v(TAG, "Screen resolution: " + screenResolution);
Log.d(TAG, "Screen resolution: " + 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) {
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);
setFlash(parameters);
setZoom(parameters);
@ -104,7 +104,7 @@ final class CameraConfigurationManager {
Point cameraResolution = null;
if (previewSizeValueString != null) {
Log.v(TAG, "preview-size-values parameter: " + previewSizeValueString);
Log.d(TAG, "preview-size-values parameter: " + previewSizeValueString);
cameraResolution = findBestPreviewSizeValue(previewSizeValueString, screenResolution);
}

View file

@ -192,7 +192,7 @@ public final class CameraManager {
public void requestAutoFocus(Handler handler, int message) {
if (camera != null && previewing) {
autoFocusCallback.setHandler(handler, message);
Log.v(TAG, "Requesting auto-focus callback");
//Log.d(TAG, "Requesting auto-focus callback");
camera.autoFocus(autoFocusCallback);
}
}
@ -225,7 +225,7 @@ public final class CameraManager {
int leftOffset = (screenResolution.x - width) / 2;
int topOffset = (screenResolution.y - height) / 2;
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;
}

View file

@ -44,9 +44,9 @@ final class FlashlightManager {
iHardwareService = getHardwareService();
setFlashEnabledMethod = getSetFlashEnabledMethod(iHardwareService);
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 {
Log.i(TAG, "This device does not support control of a flashlight");
Log.v(TAG, "This device does not support control of a flashlight");
}
}

View file

@ -52,7 +52,7 @@ final class PreviewCallback implements Camera.PreviewCallback {
message.sendToTarget();
previewHandler = null;
} else {
Log.v(TAG, "Got preview callback, but no handler for it");
Log.d(TAG, "Got preview callback, but no handler for it");
}
}

View file

@ -161,14 +161,14 @@ public final class EncodeActivity extends Activity {
bitmap = QRCodeEncoder.encodeAsBitmap(contents, BarcodeFormat.QR_CODE,
SHARE_BARCODE_DIMENSION, SHARE_BARCODE_DIMENSION);
} catch (WriterException we) {
Log.w(TAG, we.toString());
Log.w(TAG, we);
return true;
}
File bsRoot = new File(Environment.getExternalStorageDirectory(), "BarcodeScanner");
File barcodesRoot = new File(bsRoot, "Barcodes");
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);
return true;
}
@ -179,7 +179,7 @@ public final class EncodeActivity extends Activity {
fos = new FileOutputStream(barcodeFile);
bitmap.compress(Bitmap.CompressFormat.PNG, 0, fos);
} 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);
return true;
} finally {

View file

@ -351,11 +351,11 @@ final class QRCodeEncoder {
message.obj = bitmap;
message.sendToTarget();
} 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.sendToTarget();
} 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.sendToTarget();
}

View file

@ -222,7 +222,7 @@ public final class HistoryManager {
File bsRoot = new File(Environment.getExternalStorageDirectory(), "BarcodeScanner");
File historyRoot = new File(bsRoot, "History");
if (!historyRoot.exists() && !historyRoot.mkdirs()) {
Log.v(TAG, "Couldn't make dir " + historyRoot);
Log.w(TAG, "Couldn't make dir " + historyRoot);
return null;
}
File historyFile = new File(historyRoot, "history-" + System.currentTimeMillis() + ".csv");
@ -232,7 +232,7 @@ public final class HistoryManager {
out.write(history);
return Uri.parse("file://" + historyFile.getAbsolutePath());
} 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;
} finally {
if (out != null) {