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

Commit c3a214ad authored by Mark Harman's avatar Mark Harman
Browse files

Call onError on UI thread.

parent 8a7e9f99
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -1958,8 +1958,17 @@ public class CameraController2 extends CameraController {
            // need to communicate the problem to the application
            // n.b., as this is potentially serious error, we always log even if MyDebug.LOG is false
            Log.e(TAG, "error occurred after camera was opened");
            // important to run on UI thread to avoid synchronisation issues in the Preview
            final Activity activity = (Activity)context;
            activity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if( MyDebug.LOG )
                        Log.d(TAG, "onError: call camera_error_cb.onError() on UI thread");
                    camera_error_cb.onError();
                }
            });
        }
    }

    /** Opens the camera device.
@@ -2258,8 +2267,7 @@ public class CameraController2 extends CameraController {
            Log.d(TAG, "camera now opened: " + camera);

        /*{
            // test error handling
            final Handler handler = new Handler();
            // test error handling on background thread
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {