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

Commit 43d2ed5e authored by Eric Meddaugh's avatar Eric Meddaugh Committed by Arne Coucheron
Browse files

Revert "Camera: ignore torch status update for aux or compsite camera"

This reverts commit 92add565.

Causes soft reboots for devices with more than 2 cameras.

Change-Id: I687488f3de9e28854785fc44fd1ce24ce01be02a
parent 8c1a6e19
Loading
Loading
Loading
Loading
+0 −45
Original line number Diff line number Diff line
@@ -958,26 +958,6 @@ public final class CameraManager {
                    throw new IllegalArgumentException("cameraId was null");
                }

                /* Force to expose only two cameras
                 * if the package name does not falls in this bucket
                 */
                boolean exposeAuxCamera = false;
                String packageName = ActivityThread.currentOpPackageName();
                String packageList = SystemProperties.get("camera.aux.packagelist");
                if (packageList.length() > 0) {
                    TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
                    splitter.setString(packageList);
                    for (String str : splitter) {
                        if (packageName.equals(str)) {
                            exposeAuxCamera = true;
                            break;
                        }
                    }
                }
                if (exposeAuxCamera == false && (Integer.parseInt(cameraId) >= 2)) {
                    throw new IllegalArgumentException("invalid cameraId");
                }

                ICameraService cameraService = getCameraService();
                if (cameraService == null) {
                    throw new CameraAccessException(CameraAccessException.CAMERA_DISCONNECTED,
@@ -1191,31 +1171,6 @@ public final class CameraManager {
                        String.format("Camera id %s has torch status changed to 0x%x", id, status));
            }

            /* Force to ignore the aux or composite camera torch status update
             * if the package name does not falls in this bucket
             */
            boolean exposeMonoCamera = false;
            String packageName = ActivityThread.currentOpPackageName();
            String packageList = SystemProperties.get("camera.aux.packagelist");
            if (packageList.length() > 0) {
                TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
                splitter.setString(packageList);
                for (String str : splitter) {
                    if (packageName.equals(str)) {
                        exposeMonoCamera = true;
                        break;
                    }
                }
            }

            if (exposeMonoCamera == false) {
                if (Integer.parseInt(id) >= 2) {
                    Log.w(TAG, "ignore the torch status update of camera: " + id);
                    return;
                }
            }


            if (!validTorchStatus(status)) {
                Log.e(TAG, String.format("Ignoring invalid device %s torch status 0x%x", id,
                                status));