From: Vachounet Date: Fri, 19 Feb 2021 11:14:15 +0000 (+0100) Subject: MotoActions: TorchAction: register custom torch callback X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=refs%2Fheads%2Flineage-17.1;p=GitHub%2FLineageOS%2Fandroid_hardware_motorola.git MotoActions: TorchAction: register custom torch callback * Actually callback is not registered and never triggered. When user enabled torch with power long press or with qs tile and then do the gesture to disable it (or the other way around), he will have to do the gesture twice since boolean has not been updated. Change-Id: I03e88b6975300943fbeaf536fdf8552b9e3b3396 --- diff --git a/MotoActions/src/org/lineageos/settings/device/actions/TorchAction.java b/MotoActions/src/org/lineageos/settings/device/actions/TorchAction.java index 824d5d3..d1d824a 100644 --- a/MotoActions/src/org/lineageos/settings/device/actions/TorchAction.java +++ b/MotoActions/src/org/lineageos/settings/device/actions/TorchAction.java @@ -38,6 +38,7 @@ public class TorchAction implements SensorAction { public TorchAction(Context mContext) { mCameraManager = (CameraManager) mContext.getSystemService(Context.CAMERA_SERVICE); + mCameraManager.registerTorchCallback(new MyTorchCallback(), null); mVibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); try { for (final String cameraId : mCameraManager.getCameraIdList()) {