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

Commit 1caf8228 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊 Committed by Nishith Khanna
Browse files

camera: Fix camera id related crash on tablet

parent cf80665c
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -2992,10 +2992,6 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
        int best_qrcode_camera = -1;
        if( MyDebug.LOG )
            Log.d(TAG, "getBetterQRCodeCameraID");
        if( !isMultiCamEnabled() ) {
            Log.e(TAG, "getBetterQRCodeCameraID switch multi camera icon shouldn't have been visible");
            return best_qrcode_camera;
        }
        if( preview.isOpeningCamera() ) {
            if( MyDebug.LOG )
                Log.d(TAG, "getBetterQRCodeCameraID already opening camera in background thread");
+11 −3
Original line number Diff line number Diff line
@@ -9150,9 +9150,17 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu
        if (enabled) {
            this.functionalMode = FunctionalMode.QRCODE;
            rootLayout.addView(overlayQRCodeView);
            int qrcodeCamId = ((MainActivity)getContext()).getBetterQRCodeCameraID();
            MainActivity mainActivity = (MainActivity) this.getContext();
            int qrcodeCamId = 0;
            if (mainActivity.isMultiCamEnabled()) {
                int betterQrcodeCamId = mainActivity.getBetterQRCodeCameraID();
                if (qrcodeCamId >= 0) {
                    qrcodeCamId = betterQrcodeCamId;
                }
            }
            applicationInterface.setCameraIdPref(qrcodeCamId);
            if (MyDebug.LOG) {
                Log.d(TAG, "Using qrcodeCamId: " + qrcodeCamId);
            }
        } else if (overlayQRCodeView.getParent() != null) {
            rootLayout.removeView(overlayQRCodeView);