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

Commit df269ae2 authored by Akash Malik's avatar Akash Malik Committed by Android (Google) Code Review
Browse files

Merge "Delete Camera Id Remapping" into main

parents 6426a13c ff9b2e2a
Loading
Loading
Loading
Loading
+0 −54
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Point;
import android.hardware.CameraExtensionSessionStats;
import android.hardware.CameraIdRemapping;
import android.hardware.CameraStatus;
import android.hardware.ICameraService;
import android.hardware.ICameraServiceListener;
@@ -1995,17 +1994,6 @@ public final class CameraManager {
        }
    }

    /**
     * Remaps Camera Ids in the CameraService.
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.CAMERA_INJECT_EXTERNAL_CAMERA)
    public void remapCameraIds(@NonNull CameraIdRemapping cameraIdRemapping)
            throws CameraAccessException, SecurityException, IllegalArgumentException {
        CameraManagerGlobal.get().remapCameraIds(cameraIdRemapping);
    }

    /**
     * Injects session params into existing clients in the CameraService.
     *
@@ -2117,13 +2105,6 @@ public final class CameraManager {

        private final Object mLock = new Object();

        /**
         * The active CameraIdRemapping. This will be used to refresh the cameraIdRemapping state
         * in the CameraService every time we connect to it, including when the CameraService
         * Binder dies and we reconnect to it.
         */
        @Nullable private CameraIdRemapping mActiveCameraIdRemapping;

        // Access only through getCameraService to deal with binder death
        private ICameraService mCameraService;
        private boolean mHasOpenCloseListenerPermission = false;
@@ -2275,41 +2256,6 @@ public final class CameraManager {
            } catch (RemoteException e) {
                // Camera service died in all probability
            }

            if (mActiveCameraIdRemapping != null) {
                try {
                    cameraService.remapCameraIds(mActiveCameraIdRemapping);
                } catch (ServiceSpecificException e) {
                    // Unexpected failure, ignore and continue.
                    Log.e(TAG, "Unable to remap camera Ids in the camera service");
                } catch (RemoteException e) {
                    // Camera service died in all probability
                }
            }
        }

        /** Updates the cameraIdRemapping state in the CameraService. */
        public void remapCameraIds(@NonNull CameraIdRemapping cameraIdRemapping)
                throws CameraAccessException, SecurityException {
            synchronized (mLock) {
                ICameraService cameraService = getCameraService();
                if (cameraService == null) {
                    throw new CameraAccessException(
                            CameraAccessException.CAMERA_DISCONNECTED,
                            "Camera service is currently unavailable.");
                }

                try {
                    cameraService.remapCameraIds(cameraIdRemapping);
                    mActiveCameraIdRemapping = cameraIdRemapping;
                } catch (ServiceSpecificException e) {
                    throw ExceptionUtils.throwAsPublicException(e);
                } catch (RemoteException e) {
                    throw new CameraAccessException(
                            CameraAccessException.CAMERA_DISCONNECTED,
                            "Camera service is currently unavailable.");
                }
            }
        }

        /** Injects session params into an existing client for cameraid. */