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

Commit ff9b2e2a authored by malikakash's avatar malikakash
Browse files

Delete Camera Id Remapping

Bug: 330471164
Test: m
Change-Id: Ib12a5dda203f6032a252771a3bc59c473e6e891a
parent 86c52bd1
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;
@@ -1994,17 +1993,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.
     *
@@ -2116,13 +2104,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;
@@ -2274,41 +2255,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. */