Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f42790e8 authored by kaiyiz's avatar kaiyiz
Browse files

SystemUI: Fix couldn't connect to camera when Flashlight is on

Camera couldn't be started when Flashlight is on because CameraDevice
has been used.

Send broadcast in camera, receive the led flashlight intent and close
flashlight, after that user could use camera when re-launch it.

Change-Id: Idb61389d0b8f15192ea534bd28624e5d51f6527c
CRs-Fixed: 814992
parent deb1e687
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1033,6 +1033,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
        filter.addAction(Intent.ACTION_SCREEN_OFF);
        filter.addAction(Intent.ACTION_SCREEN_ON);
        // receive broadcast from SnapdragonCamera
        filter.addAction(FlashlightController.ACTION_CLOSE_FLASHLIGHT);
        if (DEBUG_MEDIA_FAKE_ARTWORK) {
            filter.addAction("fake_artwork");
        }
@@ -3286,6 +3288,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                if (DEBUG_MEDIA_FAKE_ARTWORK) {
                    updateMediaMetaData(true);
                }
            } else if (FlashlightController.ACTION_CLOSE_FLASHLIGHT.equals(action)) {
                Bundle bundle = intent.getExtras();
                if (bundle != null) {
                    if (bundle.getBoolean("camera_led", false))
                        mFlashlightController.killFlashlight();
                }
            }
        }
    };
+3 −0
Original line number Diff line number Diff line
@@ -48,6 +48,9 @@ public class FlashlightController {
    private static final int DISPATCH_OFF = 1;
    private static final int DISPATCH_AVAILABILITY_CHANGED = 2;

    public static final String ACTION_CLOSE_FLASHLIGHT =
            "org.codeaurora.snapcam.action.CLOSE_FLASHLIGHT";

    private final CameraManager mCameraManager;
    /** Call {@link #ensureHandler()} before using */
    private Handler mHandler;