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

Commit 3cd6b76d authored by Mark Harman's avatar Mark Harman Committed by Mohammed Althaf T
Browse files

Show progress for camera vendor extensions.

parent e8995f60
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@
<pre>
Version 1.53 (Work in progress)

ADDED   Camera vendor extensions show percentage progress on supported Android 14 devices.
UPDATED Improvements for popup menu and exposure UI when using large font sizes.
UPDATED Made user's font size preference apply to on-screen text.
UPDATED Changes in preparation for back button behaviour for future Android versions.
+12 −0
Original line number Diff line number Diff line
@@ -2760,6 +2760,9 @@ public class MyApplicationInterface extends BasicApplicationInterface {
        if( MyDebug.LOG )
            Log.d(TAG, "onPictureCompleted");

        // clear any toasts displayed during progress (e.g., preference_nr_mode_low_light_message, or onExtensionProgress())
        main_activity.getPreview().clearActiveFakeToast();

        PhotoMode photo_mode = getPhotoMode();
        if( main_activity.getPreview().isVideo() ) {
            if( MyDebug.LOG )
@@ -2802,6 +2805,15 @@ public class MyApplicationInterface extends BasicApplicationInterface {
        drawPreview.cameraInOperation(false);
    }

    @Override
    public void onExtensionProgress(int progress) {
        String message = "";
        if( getPhotoMode() == PhotoMode.X_Night ) {
            message = getContext().getResources().getString(R.string.preference_nr_mode_low_light_message) + "\n";
        }
        main_activity.getPreview().showToast(null, message + progress + "%", true);
    }

    @Override
    public void cameraClosed() {
        if( MyDebug.LOG )
+4 −0
Original line number Diff line number Diff line
@@ -290,6 +290,10 @@ public abstract class CameraController {
         */
        void onRawBurstPictureTaken(List<RawImage> raw_images);

        /** Reports percentage progress for vendor camera extensions. Note that not all devices support this being called.
         */
        void onExtensionProgress(int progress);

        /* This is called for when burst mode is BURSTTYPE_FOCUS or BURSTTYPE_CONTINUOUS, to ask whether it's safe to take
         * n_raw extra RAW images and n_jpegs extra JPEG images, or whether to wait.
         */
+25 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.view.SurfaceHolder;
import android.view.TextureView;
import android.widget.Toast;

import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.exifinterface.media.ExifInterface;
@@ -3106,6 +3107,11 @@ public class CameraController2 extends CameraController {
                                    Log.d(TAG, "    supported capture result key: " + key.getName());
                            }
                        }
                        if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE ) {
                            if( MyDebug.LOG ) {
                                Log.d(TAG, "    isCaptureProcessProgressAvailable: " + extension_characteristics.isCaptureProcessProgressAvailable(extension));
                            }
                        }
                    }
                }
            }
@@ -8026,6 +8032,25 @@ public class CameraController2 extends CameraController {
        public void onCaptureResultAvailable(@NonNull CameraExtensionSession session, @NonNull CaptureRequest request, @NonNull TotalCaptureResult result) {
            previewCaptureCallback.updateCachedCaptureResult(result);
        }

        @Override
        public void onCaptureProcessProgressed(@NonNull CameraExtensionSession session,
                                               @NonNull CaptureRequest request, @IntRange(from = 0, to = 100) int progress) {
            if( MyDebug.LOG )
                Log.d(TAG, "onCaptureProcessProgressed: " + progress);

            final Activity activity = (Activity)context;
            activity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if( MyDebug.LOG )
                        Log.d(TAG, "onCaptureProcessProgressed UI thread: " + progress);
                    if( picture_cb != null ) {
                        picture_cb.onExtensionProgress(progress);
                    }
                }
            });
        }
    }

    private final MyCaptureCallback previewCaptureCallback = new MyCaptureCallback();
+1 −0
Original line number Diff line number Diff line
@@ -257,5 +257,6 @@ public interface ApplicationInterface {
    boolean onRawBurstPictureTaken(List<RawImage> raw_images, Date current_date);
    void onCaptureStarted(); // called immediately before we start capturing the picture
    void onPictureCompleted(); // called after all picture callbacks have been called and returned
    void onExtensionProgress(int progress); // Reports percentage progress for vendor camera extensions. Note that not all devices support this being called.
    void onContinuousFocusMove(boolean start); // called when focusing starts/stop in continuous picture mode (in photo mode only)
}
Loading