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

Commit 34b844a8 authored by Mina Karadzic's avatar Mina Karadzic
Browse files

Use CameraCompatibilityInfo instead of rotationOverride.

Int (representing enum) rotationOverride contained multiple pieces of information: by how much to rotate in rotate-and-crop, and whether to change sensor orientation, making it difficult to parse and extend.
This refactoring allows sending more information, in a more readable format. It also ensures that no more refactorings of this variable is needed if more data needs to be sent (originally, rotationOverride was a boolean, and transition required the same amount of refactoring).

This change has started as CameraCompatMode which was planned to be copied from CameraCompatibilityInfo, but since using one implementation is possible, it will be more future-proof.

Flag: EXEMPT refactoring, which would be difficult to guard. No behaviour change.
Test: atest PropertyTest
Test: Manual, tested with and without camera compat mode.
API-Coverage-Bug: 436463722
Bug: 432651608
Bug: 365725400
Bug: 414347702

Change-Id: Ice0fbd4cbbc52debbb748f64864b05c4d0d4353d
parent fb4084bc
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -448,7 +448,6 @@ MissingGetterMatchingBuilder: android.content.AttributionSource.Builder#setNextA
MissingGetterMatchingBuilder: android.os.RemoteCallbackList.Builder#setInterfaceDiedCallback(android.os.RemoteCallbackList.Builder.InterfaceDiedCallback<E>):
    android.os.RemoteCallbackList does not declare a `getInterfaceDiedCallback()` method matching method android.os.RemoteCallbackList.Builder.setInterfaceDiedCallback(android.os.RemoteCallbackList.Builder.InterfaceDiedCallback<E>)


PublicTypedef: android.telecom.Call.AudioProcessingUseCase:
    Don't expose @IntDef: AduioProcessingUseCase must be hidden.

@@ -1045,6 +1044,8 @@ RequiresPermission: android.telephony.TelephonyManager#getSubscriberId():
    Method 'getSubscriberId' documentation mentions permissions already declared by @RequiresPermission
RequiresPermission: android.telephony.TelephonyManager#getSupportedRadioAccessFamily():
    Method 'getSupportedRadioAccessFamily' documentation mentions permissions already declared by @RequiresPermission
RequiresPermission: android.telephony.TelephonyManager#getUiccCardsInfo():
    Method 'getUiccCardsInfo' documentation duplicates auto-generated documentation by @RequiresPermission. If the permissions are only required under certain circumstances use conditional=true to suppress the auto-documentation
RequiresPermission: android.telephony.TelephonyManager#getVisualVoicemailPackageName():
    Method 'getVisualVoicemailPackageName' documentation mentions permissions already declared by @RequiresPermission
RequiresPermission: android.telephony.TelephonyManager#getVoiceMailAlphaTag():
+24 −6
Original line number Diff line number Diff line
@@ -1321,6 +1321,27 @@ package android.content.res {
    method public void setResourceResolutionLoggingEnabled(boolean);
  }

  public final class CameraCompatibilityInfo implements android.os.Parcelable {
    method public void applyToConfigurationIfNeeded(@NonNull android.content.res.Configuration);
    method public int describeContents();
    method public int getDisplayRotationSandbox();
    method public int getRotateAndCropRotation();
    method public static boolean isCameraCompatModeActive(@NonNull android.content.res.CameraCompatibilityInfo);
    method public boolean shouldLetterboxForCameraCompat();
    method public boolean shouldOverrideSensorOrientation();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.content.res.CameraCompatibilityInfo> CREATOR;
  }

  public static final class CameraCompatibilityInfo.Builder {
    ctor public CameraCompatibilityInfo.Builder();
    method public android.content.res.CameraCompatibilityInfo build();
    method public android.content.res.CameraCompatibilityInfo.Builder setDisplayRotationSandbox(int);
    method public android.content.res.CameraCompatibilityInfo.Builder setRotateAndCropRotation(int);
    method public android.content.res.CameraCompatibilityInfo.Builder setShouldLetterboxForCameraCompat(boolean);
    method public android.content.res.CameraCompatibilityInfo.Builder setShouldOverrideSensorOrientation(boolean);
  }

  public final class Configuration implements java.lang.Comparable<android.content.res.Configuration> android.os.Parcelable {
    field public int assetsSeq;
    field public final android.app.WindowConfiguration windowConfiguration;
@@ -1593,9 +1614,9 @@ package android.graphics.fonts {
package android.hardware {

  @Deprecated public class Camera {
    method @Deprecated public static void getCameraInfo(int, @NonNull android.content.Context, int, android.hardware.Camera.CameraInfo);
    method @Deprecated public static void getCameraInfo(int, @NonNull android.content.Context, android.content.res.CameraCompatibilityInfo, android.hardware.Camera.CameraInfo);
    method @Deprecated public static int getNumberOfCameras(@NonNull android.content.Context);
    method @Deprecated public static android.hardware.Camera open(int, @NonNull android.content.Context, int);
    method @Deprecated public static android.hardware.Camera open(int, @NonNull android.content.Context, @NonNull android.content.res.CameraCompatibilityInfo);
    method @Deprecated public final void setPreviewSurface(android.view.Surface) throws java.io.IOException;
  }

@@ -1690,14 +1711,11 @@ package android.hardware.camera2 {
  public final class CameraManager {
    method @NonNull public android.hardware.camera2.CameraCharacteristics getCameraCharacteristics(@NonNull String, boolean) throws android.hardware.camera2.CameraAccessException;
    method public String[] getCameraIdListNoLazy() throws android.hardware.camera2.CameraAccessException;
    method public static int getRotationOverride(@Nullable android.content.Context, @Nullable android.content.pm.PackageManager, @Nullable String);
    method public static android.content.res.CameraCompatibilityInfo getRotationOverride(@Nullable android.content.Context, @Nullable android.content.pm.PackageManager, @Nullable String);
    method @RequiresPermission(android.Manifest.permission.CAMERA) public void openCamera(@NonNull String, boolean, @Nullable android.os.Handler, @NonNull android.hardware.camera2.CameraDevice.StateCallback) throws android.hardware.camera2.CameraAccessException;
    method @RequiresPermission(allOf={android.Manifest.permission.SYSTEM_CAMERA, android.Manifest.permission.CAMERA}) public void openCamera(@NonNull String, int, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraDevice.StateCallback) throws android.hardware.camera2.CameraAccessException;
    field public static final String LANDSCAPE_TO_PORTRAIT_PROP = "camera.enable_landscape_to_portrait";
    field public static final long OVERRIDE_CAMERA_LANDSCAPE_TO_PORTRAIT = 250678880L; // 0xef10e60L
    field @FlaggedApi("com.android.window.flags.enable_camera_compat_for_desktop_windowing") public static final int ROTATION_OVERRIDE_NONE = 0; // 0x0
    field @FlaggedApi("com.android.window.flags.enable_camera_compat_for_desktop_windowing") public static final int ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT = 1; // 0x1
    field @FlaggedApi("com.android.window.flags.enable_camera_compat_for_desktop_windowing") public static final int ROTATION_OVERRIDE_ROTATION_ONLY = 2; // 0x2
  }

  public abstract static class CameraManager.AvailabilityCallback {
+88 −0
Original line number Diff line number Diff line
@@ -343,6 +343,14 @@ BroadcastBehavior: android.telephony.euicc.EuiccManager#ACTION_OTA_STATUS_CHANGE
    Field 'ACTION_OTA_STATUS_CHANGED' is missing @BroadcastBehavior


CompileTimeConstant: android.hardware.camera2.CameraManager#ROTATION_OVERRIDE_NONE:
    All constants must be defined at compile time: android.hardware.camera2.CameraManager#ROTATION_OVERRIDE_NONE
CompileTimeConstant: android.hardware.camera2.CameraManager#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT:
    All constants must be defined at compile time: android.hardware.camera2.CameraManager#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT
CompileTimeConstant: android.hardware.camera2.CameraManager#ROTATION_OVERRIDE_ROTATION_ONLY:
    All constants must be defined at compile time: android.hardware.camera2.CameraManager#ROTATION_OVERRIDE_ROTATION_ONLY


DeprecationMismatch: android.accounts.AccountManager#newChooseAccountIntent(android.accounts.Account, java.util.ArrayList<android.accounts.Account>, String[], boolean, String, String, String[], android.os.Bundle):
    Method android.accounts.AccountManager.newChooseAccountIntent(android.accounts.Account, java.util.ArrayList<android.accounts.Account>, String[], boolean, String, String, String[], android.os.Bundle): @Deprecated annotation (present) and @deprecated doc tag (not present) do not match
DeprecationMismatch: android.app.Activity#enterPictureInPictureMode():
@@ -533,6 +541,20 @@ KotlinKeyword: android.app.Notification#when:

MissingNullability: android.app.AppDetailsActivity#onCreate(android.os.Bundle) parameter #0:
    Missing nullability on parameter `savedInstanceState` in method `onCreate`
MissingNullability: android.content.res.CameraCompatibilityInfo#CREATOR:
    Missing nullability on field `CREATOR` in class `class android.content.res.CameraCompatibilityInfo`
MissingNullability: android.content.res.CameraCompatibilityInfo.Builder#build():
    Missing nullability on method `build` return
MissingNullability: android.content.res.CameraCompatibilityInfo.Builder#setDisplayRotationSandbox(int):
    Missing nullability on method `setDisplayRotationSandbox` return
MissingNullability: android.content.res.CameraCompatibilityInfo.Builder#setRotateAndCropRotation(int):
    Missing nullability on method `setRotateAndCropRotation` return
MissingNullability: android.content.res.CameraCompatibilityInfo.Builder#setShouldLetterboxForCameraCompat(boolean):
    Missing nullability on method `setShouldLetterboxForCameraCompat` return
MissingNullability: android.content.res.CameraCompatibilityInfo.Builder#setShouldOverrideSensorOrientation(boolean):
    Missing nullability on method `setShouldOverrideSensorOrientation` return
MissingNullability: android.hardware.camera2.CameraManager#getRotationOverride(android.content.Context, android.content.pm.PackageManager, String):
    Missing nullability on method `getRotationOverride` return
MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setHintIdEntry(String) parameter #0:
    Missing nullability on parameter `entryName` in method `setHintIdEntry`
MissingNullability: android.widget.ImageView#isDefaultFocusHighlightNeeded(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable) parameter #0:
@@ -823,6 +845,8 @@ RequiresPermission: android.app.backup.RestoreSession#restorePackages(long, andr
    Method 'restorePackages' documentation mentions permissions without declaring @RequiresPermission
RequiresPermission: android.app.backup.RestoreSession#restorePackages(long, android.app.backup.RestoreObserver, java.util.Set<java.lang.String>, android.app.backup.BackupManagerMonitor):
    Method 'restorePackages' documentation mentions permissions without declaring @RequiresPermission
RequiresPermission: android.app.contextualsearch.ContextualSearchManager#startContextualSearch(int):
    Method 'startContextualSearch' documentation duplicates auto-generated documentation by @RequiresPermission. If the permissions are only required under certain circumstances use conditional=true to suppress the auto-documentation
RequiresPermission: android.app.job.JobInfo.Builder#setRequiredNetwork(android.net.NetworkRequest):
    Method 'setRequiredNetwork' documentation mentions permissions without declaring @RequiresPermission
RequiresPermission: android.app.job.JobInfo.Builder#setRequiredNetworkType(int):
@@ -1235,6 +1259,8 @@ RequiresPermission: android.os.PowerManager#forceSuspend():
    Method 'forceSuspend' documentation mentions permissions already declared by @RequiresPermission
RequiresPermission: android.os.PowerManager#getPowerSaveModeTrigger():
    Method 'getPowerSaveModeTrigger' documentation mentions permissions without declaring @RequiresPermission
RequiresPermission: android.os.PowerManager#goToSleep(long, int, int):
    Method 'goToSleep' documentation duplicates auto-generated documentation by @RequiresPermission. If the permissions are only required under certain circumstances use conditional=true to suppress the auto-documentation
RequiresPermission: android.os.PowerManager#newWakeLock(int, String):
    Method 'newWakeLock' documentation mentions permissions without declaring @RequiresPermission
RequiresPermission: android.os.PowerManager#reboot(String):
@@ -2091,8 +2117,66 @@ UnflaggedApi: android.content.pm.UserInfo#isPrivateProfile():
    New API must be flagged with @FlaggedApi: method android.content.pm.UserInfo.isPrivateProfile()
UnflaggedApi: android.content.pm.UserInfo#supportsSwitchToByUser():
    Changes from deprecated to not deprecated must be flagged with @FlaggedApi: method android.content.pm.UserInfo.supportsSwitchToByUser()
UnflaggedApi: android.content.res.CameraCompatibilityInfo:
    New API must be flagged with @FlaggedApi: class android.content.res.CameraCompatibilityInfo
UnflaggedApi: android.content.res.CameraCompatibilityInfo#CREATOR:
    New API must be flagged with @FlaggedApi: field android.content.res.CameraCompatibilityInfo.CREATOR
UnflaggedApi: android.content.res.CameraCompatibilityInfo#applyToConfigurationIfNeeded(android.content.res.Configuration):
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.applyToConfigurationIfNeeded(android.content.res.Configuration)
UnflaggedApi: android.content.res.CameraCompatibilityInfo#describeContents():
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.describeContents()
UnflaggedApi: android.content.res.CameraCompatibilityInfo#getDisplayRotationSandbox():
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.getDisplayRotationSandbox()
UnflaggedApi: android.content.res.CameraCompatibilityInfo#getRotateAndCropRotation():
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.getRotateAndCropRotation()
UnflaggedApi: android.content.res.CameraCompatibilityInfo#isCameraCompatModeActive(android.content.res.CameraCompatibilityInfo):
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.isCameraCompatModeActive(android.content.res.CameraCompatibilityInfo)
UnflaggedApi: android.content.res.CameraCompatibilityInfo#shouldLetterboxForCameraCompat():
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.shouldLetterboxForCameraCompat()
UnflaggedApi: android.content.res.CameraCompatibilityInfo#shouldOverrideSensorOrientation():
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.shouldOverrideSensorOrientation()
UnflaggedApi: android.content.res.CameraCompatibilityInfo#writeToParcel(android.os.Parcel, int):
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.writeToParcel(android.os.Parcel,int)
UnflaggedApi: android.content.res.CameraCompatibilityInfo.Builder:
    New API must be flagged with @FlaggedApi: class android.content.res.CameraCompatibilityInfo.Builder
UnflaggedApi: android.content.res.CameraCompatibilityInfo.Builder#Builder():
    New API must be flagged with @FlaggedApi: constructor android.content.res.CameraCompatibilityInfo.Builder()
UnflaggedApi: android.content.res.CameraCompatibilityInfo.Builder#build():
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.Builder.build()
UnflaggedApi: android.content.res.CameraCompatibilityInfo.Builder#setDisplayRotationSandbox(int):
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.Builder.setDisplayRotationSandbox(int)
UnflaggedApi: android.content.res.CameraCompatibilityInfo.Builder#setRotateAndCropRotation(int):
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.Builder.setRotateAndCropRotation(int)
UnflaggedApi: android.content.res.CameraCompatibilityInfo.Builder#setShouldLetterboxForCameraCompat(boolean):
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.Builder.setShouldLetterboxForCameraCompat(boolean)
UnflaggedApi: android.content.res.CameraCompatibilityInfo.Builder#setShouldOverrideSensorOrientation(boolean):
    New API must be flagged with @FlaggedApi: method android.content.res.CameraCompatibilityInfo.Builder.setShouldOverrideSensorOrientation(boolean)
UnflaggedApi: android.credentials.CredentialProviderInfo#isPrimary():
    New API must be flagged with @FlaggedApi: method android.credentials.CredentialProviderInfo.isPrimary()
UnflaggedApi: android.hardware.CameraCompatMode:
    New API must be flagged with @FlaggedApi: class android.hardware.CameraCompatMode
UnflaggedApi: android.hardware.CameraCompatMode#CREATOR:
    New API must be flagged with @FlaggedApi: field android.hardware.CameraCompatMode.CREATOR
UnflaggedApi: android.hardware.CameraCompatMode#CameraCompatMode():
    New API must be flagged with @FlaggedApi: constructor android.hardware.CameraCompatMode()
UnflaggedApi: android.hardware.CameraCompatMode#CameraCompatMode(int, boolean):
    New API must be flagged with @FlaggedApi: constructor android.hardware.CameraCompatMode(int,boolean)
UnflaggedApi: android.hardware.CameraCompatMode#ROTATION_0:
    New API must be flagged with @FlaggedApi: field android.hardware.CameraCompatMode.ROTATION_0
UnflaggedApi: android.hardware.CameraCompatMode#ROTATION_180:
    New API must be flagged with @FlaggedApi: field android.hardware.CameraCompatMode.ROTATION_180
UnflaggedApi: android.hardware.CameraCompatMode#ROTATION_270:
    New API must be flagged with @FlaggedApi: field android.hardware.CameraCompatMode.ROTATION_270
UnflaggedApi: android.hardware.CameraCompatMode#ROTATION_90:
    New API must be flagged with @FlaggedApi: field android.hardware.CameraCompatMode.ROTATION_90
UnflaggedApi: android.hardware.CameraCompatMode#describeContents():
    New API must be flagged with @FlaggedApi: method android.hardware.CameraCompatMode.describeContents()
UnflaggedApi: android.hardware.CameraCompatMode#getRotateAndCrop():
    New API must be flagged with @FlaggedApi: method android.hardware.CameraCompatMode.getRotateAndCrop()
UnflaggedApi: android.hardware.CameraCompatMode#shouldOverrideSensorOrientation():
    New API must be flagged with @FlaggedApi: method android.hardware.CameraCompatMode.shouldOverrideSensorOrientation()
UnflaggedApi: android.hardware.CameraCompatMode#writeToParcel(android.os.Parcel, int):
    New API must be flagged with @FlaggedApi: method android.hardware.CameraCompatMode.writeToParcel(android.os.Parcel,int)
UnflaggedApi: android.hardware.camera2.CameraManager#getRotationOverride(android.content.Context, android.content.pm.PackageManager, String):
    New API must be flagged with @FlaggedApi: method android.hardware.camera2.CameraManager.getRotationOverride(android.content.Context,android.content.pm.PackageManager,String)
UnflaggedApi: android.hardware.input.InputManager#addUniqueIdAssociationByPort(String, String):
@@ -2281,3 +2365,7 @@ UnflaggedApi: android.window.WindowInfosListenerForTest.WindowInfo#isVisible:
    New API must be flagged with @FlaggedApi: field android.window.WindowInfosListenerForTest.WindowInfo.isVisible
UnflaggedApi: android.window.WindowInfosListenerForTest.WindowInfo#transform:
    New API must be flagged with @FlaggedApi: field android.window.WindowInfosListenerForTest.WindowInfo.transform


UserHandle: android.telephony.SmsManager#getSmsOtpTrustedPackages(android.content.Context, android.os.UserHandle):
    When a method overload is needed to target a specific UserHandle, callers should be directed to use Context.createPackageContextAsUser() and re-obtain the relevant Manager, and no new API should be added
+2 −1
Original line number Diff line number Diff line
@@ -20,11 +20,11 @@ import static android.app.WindowConfiguration.ROTATION_UNDEFINED;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.ravenwood.annotation.RavenwoodKeepWholeClass;


import java.util.Objects;

/**
@@ -44,6 +44,7 @@ import java.util.Objects;
 *
 * @hide
 */
@TestApi
@RavenwoodKeepWholeClass
public final class CameraCompatibilityInfo implements Parcelable {
    private final int mRotateAndCropRotation;
+20 −15
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.companion.virtual.VirtualDeviceParams.DEVICE_POLICY_INVALI
import static android.companion.virtual.VirtualDeviceParams.POLICY_TYPE_CAMERA;
import static android.content.Context.DEVICE_ID_DEFAULT;
import static android.system.OsConstants.EACCES;
import static android.system.OsConstants.EINVAL;
import static android.system.OsConstants.ENODEV;

import android.annotation.NonNull;
@@ -35,6 +36,7 @@ import android.companion.virtual.VirtualDeviceManager;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.AttributionSource.ScopedParcelState;
import android.content.Context;
import android.content.res.CameraCompatibilityInfo;
import android.graphics.ImageFormat;
import android.graphics.Point;
import android.graphics.Rect;
@@ -315,8 +317,8 @@ public class Camera {
     */
    public static void getCameraInfo(int cameraId, CameraInfo cameraInfo) {
        Context context = ActivityThread.currentApplication().getApplicationContext();
        final int rotationOverride = CameraManager.getRotationOverride(context);
        getCameraInfo(cameraId, context, rotationOverride, cameraInfo);
        final CameraCompatibilityInfo compatInfo = CameraManager.getRotationOverride(context);
        getCameraInfo(cameraId, context, compatInfo, cameraInfo);
    }

    /**
@@ -327,12 +329,12 @@ public class Camera {
    @SuppressLint("UnflaggedApi") // @TestApi without associated feature.
    @TestApi
    public static void getCameraInfo(int cameraId, @NonNull Context context,
            int rotationOverride, CameraInfo cameraInfo) {
            CameraCompatibilityInfo compatInfo, CameraInfo cameraInfo) {
        try (ScopedParcelState clientAttribution =
                context.getAttributionSource().asScopedParcelState()) {
            _getCameraInfo(
                    cameraId,
                    rotationOverride,
                    compatInfo,
                    clientAttribution.getParcel(),
                    getDevicePolicyFromContext(context),
                    cameraInfo);
@@ -353,7 +355,7 @@ public class Camera {

    private native static void _getCameraInfo(
            int cameraId,
            int rotationOverride,
            CameraCompatibilityInfo compatInfo,
            Parcel clientAttributionParcel,
            int devicePolicy,
            CameraInfo cameraInfo);
@@ -461,8 +463,8 @@ public class Camera {
     */
    public static Camera open(int cameraId) {
        Context context = ActivityThread.currentApplication().getApplicationContext();
        final int rotationOverride = CameraManager.getRotationOverride(context);
        return open(cameraId, context, rotationOverride);
        final CameraCompatibilityInfo compatInfo = CameraManager.getRotationOverride(context);
        return open(cameraId, context, compatInfo);
    }

    /**
@@ -472,8 +474,9 @@ public class Camera {
     */
    @SuppressLint("UnflaggedApi") // @TestApi without associated feature.
    @TestApi
    public static Camera open(int cameraId, @NonNull Context context, int rotationOverride) {
        return new Camera(cameraId, context, rotationOverride);
    public static Camera open(int cameraId, @NonNull Context context,
            @NonNull CameraCompatibilityInfo compatInfo) {
        return new Camera(cameraId, context, compatInfo);
    }

    /**
@@ -544,7 +547,7 @@ public class Camera {
        return open(cameraId);
    }

    private int cameraInit(int cameraId, Context context, int rotationOverride) {
    private int cameraInit(int cameraId, Context context, CameraCompatibilityInfo compatInfo) {
        mShutterCallback = null;
        mRawImageCallback = null;
        mJpegCallback = null;
@@ -569,7 +572,7 @@ public class Camera {
            return native_setup(
                    new WeakReference<>(this),
                    cameraId,
                    rotationOverride,
                    compatInfo,
                    forceSlowJpegMode,
                    clientAttribution.getParcel(),
                    getDevicePolicyFromContext(context));
@@ -590,11 +593,13 @@ public class Camera {
    }

    /** used by Camera#open, Camera#open(int) */
    Camera(int cameraId, @NonNull Context context, int rotationOverride) {
    Camera(int cameraId, @NonNull Context context, CameraCompatibilityInfo compatInfo) {
        Objects.requireNonNull(context);
        final int err = cameraInit(cameraId, context, rotationOverride);
        final int err = cameraInit(cameraId, context, compatInfo);
        if (checkInitErrors(err)) {
            if (err == -EACCES) {
            if (err == -EINVAL) {
                throw new RuntimeException("Parsing arguments failed");
            } else if (err == -EACCES) {
                throw new RuntimeException("Fail to connect to camera service");
            } else if (err == -ENODEV) {
                throw new RuntimeException("Camera initialization failed");
@@ -659,7 +664,7 @@ public class Camera {
    private native int native_setup(
            Object cameraThis,
            int cameraId,
            int rotationOverride,
            CameraCompatibilityInfo compatMode,
            boolean forceSlowJpegMode,
            Parcel clientAttributionParcel,
            int devicePolicy);
Loading