Camera: Allow clients to query for extra profile latency

Additionally switch the dynamic range profiles to long values
instead of integers.

Bug: 215396395
Test: Camera CTS

Change-Id: I4700af73f31423fd9316cfb08a351b0cde731d76
diff --git a/core/api/current.txt b/core/api/current.txt
index 3a6fc59..e5071e4 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -17391,7 +17391,7 @@
     field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_OUTPUT_RAW;
     field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_PARTIAL_RESULT_COUNT;
     field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Byte> REQUEST_PIPELINE_MAX_DEPTH;
-    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Long> REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE;
     field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Float> SCALER_AVAILABLE_MAX_DIGITAL_ZOOM;
     field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> SCALER_AVAILABLE_ROTATE_AND_CROP_MODES;
     field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> SCALER_AVAILABLE_STREAM_USE_CASES;
@@ -18111,22 +18111,23 @@
   }
 
   public final class DynamicRangeProfiles {
-    ctor public DynamicRangeProfiles(@NonNull int[]);
-    method @NonNull public java.util.Set<java.lang.Integer> getProfileCaptureRequestConstraints(int);
-    method @NonNull public java.util.Set<java.lang.Integer> getSupportedProfiles();
-    field public static final int DOLBY_VISION_10B_HDR_OEM = 64; // 0x40
-    field public static final int DOLBY_VISION_10B_HDR_OEM_PO = 128; // 0x80
-    field public static final int DOLBY_VISION_10B_HDR_REF = 16; // 0x10
-    field public static final int DOLBY_VISION_10B_HDR_REF_PO = 32; // 0x20
-    field public static final int DOLBY_VISION_8B_HDR_OEM = 1024; // 0x400
-    field public static final int DOLBY_VISION_8B_HDR_OEM_PO = 2048; // 0x800
-    field public static final int DOLBY_VISION_8B_HDR_REF = 256; // 0x100
-    field public static final int DOLBY_VISION_8B_HDR_REF_PO = 512; // 0x200
-    field public static final int HDR10 = 4; // 0x4
-    field public static final int HDR10_PLUS = 8; // 0x8
-    field public static final int HLG10 = 2; // 0x2
-    field public static final int PUBLIC_MAX = 4096; // 0x1000
-    field public static final int STANDARD = 1; // 0x1
+    ctor public DynamicRangeProfiles(@NonNull long[]);
+    method @NonNull public java.util.Set<java.lang.Long> getProfileCaptureRequestConstraints(long);
+    method @NonNull public java.util.Set<java.lang.Long> getSupportedProfiles();
+    method public boolean isExtraLatencyPresent(long);
+    field public static final long DOLBY_VISION_10B_HDR_OEM = 64L; // 0x40L
+    field public static final long DOLBY_VISION_10B_HDR_OEM_PO = 128L; // 0x80L
+    field public static final long DOLBY_VISION_10B_HDR_REF = 16L; // 0x10L
+    field public static final long DOLBY_VISION_10B_HDR_REF_PO = 32L; // 0x20L
+    field public static final long DOLBY_VISION_8B_HDR_OEM = 1024L; // 0x400L
+    field public static final long DOLBY_VISION_8B_HDR_OEM_PO = 2048L; // 0x800L
+    field public static final long DOLBY_VISION_8B_HDR_REF = 256L; // 0x100L
+    field public static final long DOLBY_VISION_8B_HDR_REF_PO = 512L; // 0x200L
+    field public static final long HDR10 = 4L; // 0x4L
+    field public static final long HDR10_PLUS = 8L; // 0x8L
+    field public static final long HLG10 = 2L; // 0x2L
+    field public static final long PUBLIC_MAX = 4096L; // 0x1000L
+    field public static final long STANDARD = 1L; // 0x1L
   }
 
   public final class ExtensionSessionConfiguration {
@@ -18233,7 +18234,7 @@
     method @NonNull public static java.util.Collection<android.hardware.camera2.params.OutputConfiguration> createInstancesForMultiResolutionOutput(@NonNull android.hardware.camera2.MultiResolutionImageReader);
     method public int describeContents();
     method public void enableSurfaceSharing();
-    method public int getDynamicRangeProfile();
+    method public long getDynamicRangeProfile();
     method public int getMaxSharedSurfaceCount();
     method public int getMirrorMode();
     method public int getStreamUseCase();
@@ -18243,7 +18244,7 @@
     method public int getTimestampBase();
     method public void removeSensorPixelModeUsed(int);
     method public void removeSurface(@NonNull android.view.Surface);
-    method public void setDynamicRangeProfile(int);
+    method public void setDynamicRangeProfile(long);
     method public void setMirrorMode(int);
     method public void setPhysicalCameraId(@Nullable String);
     method public void setStreamUseCase(int);
diff --git a/core/java/android/hardware/CameraStreamStats.java b/core/java/android/hardware/CameraStreamStats.java
index 85890c1..823d454 100644
--- a/core/java/android/hardware/CameraStreamStats.java
+++ b/core/java/android/hardware/CameraStreamStats.java
@@ -47,7 +47,7 @@
     private int mHistogramType;
     private float[] mHistogramBins;
     private long[] mHistogramCounts;
-    private int mDynamicRangeProfile;
+    private long mDynamicRangeProfile;
     private int mStreamUseCase;
 
     private static final String TAG = "CameraStreamStats";
@@ -70,7 +70,7 @@
 
     public CameraStreamStats(int width, int height, int format,
             int dataSpace, long usage, long requestCount, long errorCount,
-            int startLatencyMs, int maxHalBuffers, int maxAppBuffers, int dynamicRangeProfile,
+            int startLatencyMs, int maxHalBuffers, int maxAppBuffers, long dynamicRangeProfile,
             int streamUseCase) {
         mWidth = width;
         mHeight = height;
@@ -130,7 +130,7 @@
         dest.writeInt(mHistogramType);
         dest.writeFloatArray(mHistogramBins);
         dest.writeLongArray(mHistogramCounts);
-        dest.writeInt(mDynamicRangeProfile);
+        dest.writeLong(mDynamicRangeProfile);
         dest.writeInt(mStreamUseCase);
     }
 
@@ -148,7 +148,7 @@
         mHistogramType = in.readInt();
         mHistogramBins = in.createFloatArray();
         mHistogramCounts = in.createLongArray();
-        mDynamicRangeProfile = in.readInt();
+        mDynamicRangeProfile = in.readLong();
         mStreamUseCase = in.readInt();
     }
 
@@ -204,7 +204,7 @@
         return mHistogramCounts;
     }
 
-    public int getDynamicRangeProfile() {
+    public long getDynamicRangeProfile() {
         return mDynamicRangeProfile;
     }
 
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index 524fe79..7bebe1f 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -2448,8 +2448,8 @@
      * @see #REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX
      * @hide
      */
-    public static final Key<int[]> REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP =
-            new Key<int[]>("android.request.availableDynamicRangeProfilesMap", int[].class);
+    public static final Key<long[]> REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP =
+            new Key<long[]>("android.request.availableDynamicRangeProfilesMap", long[].class);
 
     /**
      * <p>Recommended 10-bit dynamic range profile.</p>
@@ -2464,8 +2464,8 @@
      */
     @PublicKey
     @NonNull
-    public static final Key<Integer> REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE =
-            new Key<Integer>("android.request.recommendedTenBitDynamicRangeProfile", int.class);
+    public static final Key<Long> REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE =
+            new Key<Long>("android.request.recommendedTenBitDynamicRangeProfile", long.class);
 
     /**
      * <p>The list of image formats that are supported by this
diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java
index 8f42b1f..73735ed 100644
--- a/core/java/android/hardware/camera2/CameraDevice.java
+++ b/core/java/android/hardware/camera2/CameraDevice.java
@@ -990,7 +990,7 @@
      * <p>Reprocessing with 10-bit output targets on 10-bit capable
      * {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT} devices is
      * not supported. Trying to initialize a repreocessable capture session with one ore more
-     * output configurations set {@link OutputConfiguration#setDynamicRangeProfile(int)} to use
+     * output configurations set {@link OutputConfiguration#setDynamicRangeProfile} to use
      * a 10-bit dynamic range profile {@link android.hardware.camera2.params.DynamicRangeProfiles}
      * will trigger {@link IllegalArgumentException}.</p>
      *
@@ -1179,7 +1179,7 @@
      * @see #createCaptureSessionByOutputConfigurations
      * @see #createReprocessableCaptureSession
      * @see #createConstrainedHighSpeedCaptureSession
-     * @see OutputConfiguration#setDynamicRangeProfile(int)
+     * @see OutputConfiguration#setDynamicRangeProfile
      * @see android.hardware.camera2.params.DynamicRangeProfiles
      */
     public void createCaptureSession(
diff --git a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
index 4fb496d..468e604 100644
--- a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
+++ b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
@@ -1058,7 +1058,7 @@
     }
 
     private DynamicRangeProfiles getDynamicRangeProfiles() {
-        int[] profileArray = getBase(
+        long[] profileArray = getBase(
                 CameraCharacteristics.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP);
 
         if (profileArray == null) {
diff --git a/core/java/android/hardware/camera2/params/DynamicRangeProfiles.java b/core/java/android/hardware/camera2/params/DynamicRangeProfiles.java
index 5c1a4aa..cbd84e7 100644
--- a/core/java/android/hardware/camera2/params/DynamicRangeProfiles.java
+++ b/core/java/android/hardware/camera2/params/DynamicRangeProfiles.java
@@ -16,7 +16,7 @@
 
 package android.hardware.camera2.params;
 
-import android.annotation.IntDef;
+import android.annotation.LongDef;
 import android.annotation.NonNull;
 
 import android.hardware.camera2.CameraMetadata;
@@ -27,7 +27,6 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Objects;
 import java.util.Set;
 
 /**
@@ -44,20 +43,20 @@
  *
  * <p>Some devices may not be able to support 8-bit and/or 10-bit output with different dynamic
  * range profiles within the same capture request. Such device specific constraints can be queried
- * by calling {@link #getProfileCaptureRequestConstraints(int)}. Do note that unsupported
+ * by calling {@link #getProfileCaptureRequestConstraints}. Do note that unsupported
  * combinations will result in {@link IllegalArgumentException} when trying to submit a capture
  * request. Capture requests that only reference outputs configured using the same dynamic range
  * profile value will never fail due to such constraints.</p>
  *
- * @see OutputConfiguration#setDynamicRangeProfile(int)
+ * @see OutputConfiguration#setDynamicRangeProfile
  */
 public final class DynamicRangeProfiles {
     /**
      * This the default 8-bit standard profile that will be used in case where camera clients do not
      * explicitly configure a supported dynamic range profile by calling
-     * {@link OutputConfiguration#setDynamicRangeProfile(int)}.
+     * {@link OutputConfiguration#setDynamicRangeProfile}.
      */
-    public static final int STANDARD =
+    public static final long STANDARD =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD;
 
     /**
@@ -65,7 +64,7 @@
      *
      * <p>All 10-bit output capable devices are required to support this profile.</p>
      */
-    public static final int HLG10  =
+    public static final long HLG10  =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10;
 
     /**
@@ -74,7 +73,7 @@
      * <p>This profile utilizes internal static metadata to increase the quality
      * of the capture.</p>
      */
-    public static final int HDR10  =
+    public static final long HDR10  =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10;
 
     /**
@@ -83,7 +82,7 @@
      * <p>In contrast to HDR10, this profile uses internal per-frame metadata
      * to further enhance the quality of the capture.</p>
      */
-    public static final int HDR10_PLUS =
+    public static final long HDR10_PLUS =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS;
 
     /**
@@ -91,13 +90,13 @@
      * accurate capture. This would typically differ from what a specific device
      * might want to tune for a consumer optimized Dolby Vision general capture.</p>
      */
-    public static final int DOLBY_VISION_10B_HDR_REF =
+    public static final long DOLBY_VISION_10B_HDR_REF =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF;
 
     /**
      * <p>This is the power optimized mode for 10-bit Dolby Vision HDR Reference Mode.</p>
      */
-    public static final int DOLBY_VISION_10B_HDR_REF_PO =
+    public static final long DOLBY_VISION_10B_HDR_REF_PO =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO;
 
     /**
@@ -107,52 +106,52 @@
      * that each specific device would have a different look for their default
      * Dolby Vision capture.</p>
      */
-    public static final int DOLBY_VISION_10B_HDR_OEM =
+    public static final long DOLBY_VISION_10B_HDR_OEM =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM;
 
     /**
      * <p>This is the power optimized mode for 10-bit Dolby Vision HDR device specific capture
      * Mode.</p>
      */
-    public static final int DOLBY_VISION_10B_HDR_OEM_PO =
+    public static final long DOLBY_VISION_10B_HDR_OEM_PO =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO;
 
     /**
      * <p>This is the 8-bit version of the Dolby Vision reference capture mode optimized
      * for scene accuracy.</p>
      */
-    public static final int DOLBY_VISION_8B_HDR_REF =
+    public static final long DOLBY_VISION_8B_HDR_REF =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF;
 
     /**
      * <p>This is the power optimized mode for 8-bit Dolby Vision HDR Reference Mode.</p>
      */
-    public static final int DOLBY_VISION_8B_HDR_REF_PO =
+    public static final long DOLBY_VISION_8B_HDR_REF_PO =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO;
 
     /**
      * <p>This is the 8-bit version of device specific tuned and optimized Dolby Vision
      * capture mode.</p>
      */
-    public static final int DOLBY_VISION_8B_HDR_OEM =
+    public static final long DOLBY_VISION_8B_HDR_OEM =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM;
 
     /**
      * <p>This is the power optimized mode for 8-bit Dolby Vision HDR device specific
      * capture Mode.</p>
      */
-    public static final int DOLBY_VISION_8B_HDR_OEM_PO =
+    public static final long DOLBY_VISION_8B_HDR_OEM_PO =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO;
 
     /*
      * @hide
      */
-    public static final int PUBLIC_MAX =
+    public static final long PUBLIC_MAX =
             CameraMetadata.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX;
 
      /** @hide */
     @Retention(RetentionPolicy.SOURCE)
-    @IntDef(prefix = {"PROFILE_"}, value =
+    @LongDef(prefix = {"PROFILE_"}, value =
             {STANDARD,
              HLG10,
              HDR10,
@@ -168,7 +167,8 @@
     public @interface Profile {
     }
 
-    private final HashMap<Integer, Set<Integer>> mProfileMap = new HashMap<>();
+    private final HashMap<Long, Set<Long>> mProfileMap = new HashMap<>();
+    private final HashMap<Long, Boolean> mLookahedLatencyMap = new HashMap<>();
 
     /**
      * Create a new immutable DynamicRangeProfiles instance.
@@ -193,23 +193,23 @@
      *            if {@code elements} is {@code null}
      *
      */
-    public DynamicRangeProfiles(@NonNull final int[] elements) {
-        if ((elements.length % 2) != 0) {
+    public DynamicRangeProfiles(@NonNull final long[] elements) {
+        if ((elements.length % 3) != 0) {
             throw new IllegalArgumentException("Dynamic range profile map length " +
                     elements.length + " is not even!");
         }
 
-        for (int i = 0; i < elements.length; i += 2) {
+        for (int i = 0; i < elements.length; i += 3) {
             checkProfileValue(elements[i]);
             // STANDARD is not expected to be included
             if (elements[i] == STANDARD) {
                 throw new IllegalArgumentException("Dynamic range profile map must not include a"
                         + " STANDARD profile entry!");
             }
-            HashSet<Integer> profiles = new HashSet<>();
+            HashSet<Long> profiles = new HashSet<>();
 
             if (elements[i+1] != 0) {
-                for (int profile = STANDARD; profile < PUBLIC_MAX; profile <<= 1) {
+                for (long profile = STANDARD; profile < PUBLIC_MAX; profile <<= 1) {
                     if ((elements[i+1] & profile) != 0) {
                         profiles.add(profile);
                     }
@@ -217,12 +217,13 @@
             }
 
             mProfileMap.put(elements[i], profiles);
+            mLookahedLatencyMap.put(elements[i], elements[i+2] != 0L);
         }
 
         // Build the STANDARD constraints depending on the advertised 10-bit limitations
-        HashSet<Integer> standardConstraints = new HashSet<>();
+        HashSet<Long> standardConstraints = new HashSet<>();
         standardConstraints.add(STANDARD);
-        for(Integer profile : mProfileMap.keySet()) {
+        for(Long profile : mProfileMap.keySet()) {
             if (mProfileMap.get(profile).isEmpty() || mProfileMap.get(profile).contains(STANDARD)) {
                 standardConstraints.add(profile);
             }
@@ -235,24 +236,15 @@
     /**
      * @hide
      */
-    public static void checkProfileValue(int profile) {
-        switch (profile) {
-            case STANDARD:
-            case HLG10:
-            case HDR10:
-            case HDR10_PLUS:
-            case DOLBY_VISION_10B_HDR_REF:
-            case DOLBY_VISION_10B_HDR_REF_PO:
-            case DOLBY_VISION_10B_HDR_OEM:
-            case DOLBY_VISION_10B_HDR_OEM_PO:
-            case DOLBY_VISION_8B_HDR_REF:
-            case DOLBY_VISION_8B_HDR_REF_PO:
-            case DOLBY_VISION_8B_HDR_OEM:
-            case DOLBY_VISION_8B_HDR_OEM_PO:
-                //No-op
-                break;
-            default:
-                throw new IllegalArgumentException("Unknown profile " + profile);
+    public static void checkProfileValue(long profile) {
+        if (profile == STANDARD || profile == HLG10 || profile == HDR10 || profile == HDR10_PLUS
+                || profile == DOLBY_VISION_10B_HDR_REF || profile == DOLBY_VISION_10B_HDR_REF_PO
+                || profile == DOLBY_VISION_10B_HDR_OEM || profile == DOLBY_VISION_10B_HDR_OEM_PO
+                || profile == DOLBY_VISION_8B_HDR_REF || profile == DOLBY_VISION_8B_HDR_REF_PO
+                || profile == DOLBY_VISION_8B_HDR_OEM
+                || profile == DOLBY_VISION_8B_HDR_OEM_PO) {//No-op
+        } else {
+            throw new IllegalArgumentException("Unknown profile " + profile);
         }
     }
 
@@ -261,7 +253,7 @@
      *
      * @return non-modifiable set of dynamic range profiles
      */
-     public @NonNull Set<Integer> getSupportedProfiles() {
+     public @NonNull Set<Long> getSupportedProfiles() {
          return Collections.unmodifiableSet(mProfileMap.keySet());
      }
 
@@ -272,7 +264,7 @@
      *
      * <p>For example if assume that a particular 10-bit output capable device
      * returns ({@link #STANDARD}, {@link #HLG10}, {@link #HDR10}) as result from calling
-     * {@link #getSupportedProfiles()} and {@link #getProfileCaptureRequestConstraints(int)}
+     * {@link #getSupportedProfiles()} and {@link #getProfileCaptureRequestConstraints}
      * returns ({@link #STANDARD}, {@link #HLG10}) when given an argument of {@link #STANDARD}.
      * This means that the corresponding camera device will only accept and process capture requests
      * that reference outputs configured using {@link #HDR10} dynamic profile or alternatively
@@ -288,14 +280,40 @@
      *                                    within the list returned by
      *                                    getSupportedProfiles()
      *
-     * @see OutputConfiguration#setDynamicRangeProfile(int)
+     * @see OutputConfiguration#setDynamicRangeProfile
      */
-     public @NonNull Set<Integer> getProfileCaptureRequestConstraints(@Profile int profile) {
-         Set<Integer> ret = mProfileMap.get(profile);
+     public @NonNull Set<Long> getProfileCaptureRequestConstraints(@Profile long profile) {
+         Set<Long> ret = mProfileMap.get(profile);
          if (ret == null) {
              throw new IllegalArgumentException("Unsupported profile!");
          }
 
          return Collections.unmodifiableSet(ret);
      }
+
+    /**
+     * Check whether a given dynamic range profile is suitable for latency sensitive use cases.
+     *
+     * <p>Due to internal lookahead logic, camera outputs configured with some dynamic range
+     * profiles may experience additional latency greater than 3 buffers. Using camera outputs
+     * with such profiles for latency sensitive use cases such as camera preview is not
+     * recommended. Profiles that have such extra streaming delay are typically utilized for
+     * scenarios such as offscreen video recording.</p>
+     *
+     * @return true if the given profile is not suitable for latency sensitive use cases, false
+     *         otherwise
+     * @throws IllegalArgumentException - If the profile argument is not
+     *                                    within the list returned by
+     *                                    getSupportedProfiles()
+     *
+     * @see OutputConfiguration#setDynamicRangeProfile
+     */
+    public boolean isExtraLatencyPresent(@Profile long profile) {
+        Boolean ret = mLookahedLatencyMap.get(profile);
+        if (ret == null) {
+            throw new IllegalArgumentException("Unsupported profile!");
+        }
+
+        return ret;
+    }
 }
diff --git a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
index 8c0dcfc..465abfb 100644
--- a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
+++ b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
@@ -246,7 +246,7 @@
          * @return true if stream is able to output 10-bit pixels
          *
          * @see android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT
-         * @see OutputConfiguration#setDynamicRangeProfile(int)
+         * @see OutputConfiguration#setDynamicRangeProfile
          */
         public boolean is10BitCapable() {
             return mIs10BitCapable;
diff --git a/core/java/android/hardware/camera2/params/OutputConfiguration.java b/core/java/android/hardware/camera2/params/OutputConfiguration.java
index 8093764..2350b7c 100644
--- a/core/java/android/hardware/camera2/params/OutputConfiguration.java
+++ b/core/java/android/hardware/camera2/params/OutputConfiguration.java
@@ -421,7 +421,7 @@
      * {@link android.media.MediaCodec} etc.)
      * or {@link ImageFormat#YCBCR_P010}.</p>
      */
-    public void setDynamicRangeProfile(@Profile int profile) {
+    public void setDynamicRangeProfile(@Profile long profile) {
         mDynamicRangeProfile = profile;
     }
 
@@ -430,7 +430,7 @@
      *
      * @return the currently set dynamic range profile
      */
-    public @Profile int getDynamicRangeProfile() {
+    public @Profile long getDynamicRangeProfile() {
         return mDynamicRangeProfile;
     }
 
@@ -1070,7 +1070,7 @@
         int streamUseCase = source.readInt();
 
         checkArgumentInRange(rotation, ROTATION_0, ROTATION_270, "Rotation constant");
-        int dynamicRangeProfile = source.readInt();
+        long dynamicRangeProfile = source.readLong();
         DynamicRangeProfiles.checkProfileValue(dynamicRangeProfile);
 
         int timestampBase = source.readInt();
@@ -1217,7 +1217,7 @@
         dest.writeInt(mIsMultiResolution ? 1 : 0);
         // writeList doesn't seem to work well with Integer list.
         dest.writeIntArray(convertIntegerToIntList(mSensorPixelModesUsed));
-        dest.writeInt(mDynamicRangeProfile);
+        dest.writeLong(mDynamicRangeProfile);
         dest.writeInt(mStreamUseCase);
         dest.writeInt(mTimestampBase);
         dest.writeInt(mMirrorMode);
@@ -1335,7 +1335,7 @@
     // The sensor pixel modes that this OutputConfiguration will use
     private ArrayList<Integer> mSensorPixelModesUsed;
     // Dynamic range profile
-    private int mDynamicRangeProfile;
+    private long mDynamicRangeProfile;
     // Stream use case
     private int mStreamUseCase;
     // Timestamp base
diff --git a/proto/src/camera.proto b/proto/src/camera.proto
index 2d62f32..4082118 100644
--- a/proto/src/camera.proto
+++ b/proto/src/camera.proto
@@ -64,7 +64,7 @@
     repeated int64 histogram_counts = 13;
 
     // The dynamic range profile of the stream
-    optional int32 dynamic_range_profile = 14;
+    optional int64 dynamic_range_profile = 14;
     // The stream use case
     optional int32 stream_use_case = 15;
 }