mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 11:47:26 -08:00
Issue #90 : possibly relevant improvement to logic - no point in canceling the AsyncTask which will always be running at that point if it exists
This commit is contained in:
parent
9e8a47c7e4
commit
264a49a148
|
@ -64,7 +64,7 @@ final class AutoFocusManager implements Camera.AutoFocusCallback {
|
|||
autoFocusAgainLater();
|
||||
}
|
||||
|
||||
private void autoFocusAgainLater() {
|
||||
private synchronized void autoFocusAgainLater() {
|
||||
if (!stopped && outstandingTask == null) {
|
||||
AutoFocusTask newTask = new AutoFocusTask();
|
||||
try {
|
||||
|
@ -78,7 +78,7 @@ final class AutoFocusManager implements Camera.AutoFocusCallback {
|
|||
|
||||
synchronized void start() {
|
||||
if (useAutoFocus) {
|
||||
cancelOutstandingTask();
|
||||
outstandingTask = null;
|
||||
if (!stopped && !focusing) {
|
||||
try {
|
||||
camera.autoFocus(this);
|
||||
|
@ -93,7 +93,7 @@ final class AutoFocusManager implements Camera.AutoFocusCallback {
|
|||
}
|
||||
}
|
||||
|
||||
private void cancelOutstandingTask() {
|
||||
private synchronized void cancelOutstandingTask() {
|
||||
if (outstandingTask != null) {
|
||||
if (outstandingTask.getStatus() != AsyncTask.Status.FINISHED) {
|
||||
outstandingTask.cancel(true);
|
||||
|
|
Loading…
Reference in a new issue