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

Commit 265a0690 authored by Shuzhen Wang's avatar Shuzhen Wang
Browse files

Camera: Turn off torch at provider startup

Flashlight could be stuck at ON after system_server crashes
(which results in cameraserver to restart).
As a workaround, turn flash off at the provider start.

Alternative considered: restart HAL process when cameraserver
restarts. However, even with that, some device still fails to
turn off flashlight.

Test: Camera CTS, kill system_server with flash on
Bug: 247038031
Change-Id: I8a49ce8a541dc0537348dc16b3b48b96b10c89f6
parent 861cba83
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -550,6 +550,11 @@ AidlProviderInfo::AidlDeviceInfo3::AidlDeviceInfo3(
                    "ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL tags: %s (%d)", __FUNCTION__,
                    strerror(-res), res);
        }

        // b/247038031: In case of system_server crash, camera_server is
        // restarted as well. If flashlight is turned on before the crash, it
        // may be stuck to be on. As a workaround, set torch mode to be OFF.
        interface->setTorchMode(false);
    } else {
        mHasFlashUnit = false;
    }