Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 13976d3

Browse files
committed
Process feedback on PR
According to feedback from @blasten on PR, the following changes are made: - Removed an obsolete empty line in the CHANGELOG.md; - Return early from the `startBackgroundThread` function when the `backgroundHandlerThread is not `null`. This simplifies the method making it easier to read and understand.
1 parent 42287a4 commit 13976d3

File tree

1 file changed

+10
-8
lines changed
  • packages/camera/camera/android/src/main/java/io/flutter/plugins/camera

1 file changed

+10
-8
lines changed

packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -574,15 +574,17 @@ private Display getDefaultDisplay() {
574574

575575
/** Starts a background thread and its {@link Handler}. */
576576
public void startBackgroundThread() {
577-
if (backgroundHandlerThread == null) {
578-
backgroundHandlerThread = HandlerThreadFactory.create("CameraBackground");
579-
try {
580-
backgroundHandlerThread.start();
581-
} catch (IllegalThreadStateException e) {
582-
// Ignore exception in case the thread has already started.
583-
}
584-
backgroundHandler = HandlerFactory.create(backgroundHandlerThread.getLooper());
577+
if (backgroundHandlerThread != null) {
578+
return;
579+
}
580+
581+
backgroundHandlerThread = HandlerThreadFactory.create("CameraBackground");
582+
try {
583+
backgroundHandlerThread.start();
584+
} catch (IllegalThreadStateException e) {
585+
// Ignore exception in case the thread has already started.
585586
}
587+
backgroundHandler = HandlerFactory.create(backgroundHandlerThread.getLooper());
586588
}
587589

588590
/** Stops the background thread and its {@link Handler}. */

0 commit comments

Comments
 (0)