Merge "Camera: Rename DeviceStateOrientationMap" into sc-v2-dev am: cd056ddbb8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16042088 Change-Id: I8269adbd3cc7542199ad27718bc46a311d57709e
This commit is contained in:
@@ -17966,7 +17966,7 @@ package android.hardware.camera2 {
|
|||||||
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> EDGE_AVAILABLE_EDGE_MODES;
|
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> EDGE_AVAILABLE_EDGE_MODES;
|
||||||
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> FLASH_INFO_AVAILABLE;
|
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> FLASH_INFO_AVAILABLE;
|
||||||
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES;
|
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES;
|
||||||
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.DeviceStateOrientationMap> INFO_DEVICE_STATE_ORIENTATION_MAP;
|
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.DeviceStateSensorOrientationMap> INFO_DEVICE_STATE_SENSOR_ORIENTATION_MAP;
|
||||||
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> INFO_SUPPORTED_HARDWARE_LEVEL;
|
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> INFO_SUPPORTED_HARDWARE_LEVEL;
|
||||||
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.String> INFO_VERSION;
|
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.String> INFO_VERSION;
|
||||||
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size[]> JPEG_AVAILABLE_THUMBNAIL_SIZES;
|
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size[]> JPEG_AVAILABLE_THUMBNAIL_SIZES;
|
||||||
@@ -18661,7 +18661,7 @@ package android.hardware.camera2.params {
|
|||||||
method public android.util.Rational getElement(int, int);
|
method public android.util.Rational getElement(int, int);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class DeviceStateOrientationMap {
|
public final class DeviceStateSensorOrientationMap {
|
||||||
method public int getSensorOrientation(long);
|
method public int getSensorOrientation(long);
|
||||||
field public static final long FOLDED = 4L; // 0x4L
|
field public static final long FOLDED = 4L; // 0x4L
|
||||||
field public static final long NORMAL = 0L; // 0x0L
|
field public static final long NORMAL = 0L; // 0x0L
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import android.compat.annotation.UnsupportedAppUsage;
|
|||||||
import android.hardware.camera2.impl.CameraMetadataNative;
|
import android.hardware.camera2.impl.CameraMetadataNative;
|
||||||
import android.hardware.camera2.impl.PublicKey;
|
import android.hardware.camera2.impl.PublicKey;
|
||||||
import android.hardware.camera2.impl.SyntheticKey;
|
import android.hardware.camera2.impl.SyntheticKey;
|
||||||
import android.hardware.camera2.params.DeviceStateOrientationMap;
|
import android.hardware.camera2.params.DeviceStateSensorOrientationMap;
|
||||||
import android.hardware.camera2.params.RecommendedStreamConfigurationMap;
|
import android.hardware.camera2.params.RecommendedStreamConfigurationMap;
|
||||||
import android.hardware.camera2.params.SessionConfiguration;
|
import android.hardware.camera2.params.SessionConfiguration;
|
||||||
import android.hardware.camera2.utils.TypeReference;
|
import android.hardware.camera2.utils.TypeReference;
|
||||||
@@ -258,11 +258,12 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
|
|||||||
private <T> T overrideProperty(Key<T> key) {
|
private <T> T overrideProperty(Key<T> key) {
|
||||||
if (CameraCharacteristics.SENSOR_ORIENTATION.equals(key) && (mFoldStateListener != null) &&
|
if (CameraCharacteristics.SENSOR_ORIENTATION.equals(key) && (mFoldStateListener != null) &&
|
||||||
(mProperties.get(CameraCharacteristics.INFO_DEVICE_STATE_ORIENTATIONS) != null)) {
|
(mProperties.get(CameraCharacteristics.INFO_DEVICE_STATE_ORIENTATIONS) != null)) {
|
||||||
DeviceStateOrientationMap deviceStateOrientationMap =
|
DeviceStateSensorOrientationMap deviceStateSensorOrientationMap =
|
||||||
mProperties.get(CameraCharacteristics.INFO_DEVICE_STATE_ORIENTATION_MAP);
|
mProperties.get(CameraCharacteristics.INFO_DEVICE_STATE_SENSOR_ORIENTATION_MAP);
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
Integer ret = deviceStateOrientationMap.getSensorOrientation(mFoldedDeviceState ?
|
Integer ret = deviceStateSensorOrientationMap.getSensorOrientation(
|
||||||
DeviceStateOrientationMap.FOLDED : DeviceStateOrientationMap.NORMAL);
|
mFoldedDeviceState ? DeviceStateSensorOrientationMap.FOLDED :
|
||||||
|
DeviceStateSensorOrientationMap.NORMAL);
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
return (T) ret;
|
return (T) ret;
|
||||||
} else {
|
} else {
|
||||||
@@ -4056,7 +4057,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
|
|||||||
* Clients are advised to not cache or store the orientation value of such logical sensors.
|
* Clients are advised to not cache or store the orientation value of such logical sensors.
|
||||||
* In case repeated queries to CameraCharacteristics are not preferred, then clients can
|
* In case repeated queries to CameraCharacteristics are not preferred, then clients can
|
||||||
* also access the entire mapping from device state to sensor orientation in
|
* also access the entire mapping from device state to sensor orientation in
|
||||||
* {@link android.hardware.camera2.params.DeviceStateOrientationMap }.
|
* {@link android.hardware.camera2.params.DeviceStateSensorOrientationMap }.
|
||||||
* Do note that a dynamically changing sensor orientation value in camera characteristics
|
* Do note that a dynamically changing sensor orientation value in camera characteristics
|
||||||
* will not be the best way to establish the orientation per frame. Clients that want to
|
* will not be the best way to establish the orientation per frame. Clients that want to
|
||||||
* know the sensor orientation of a particular captured frame should query the
|
* know the sensor orientation of a particular captured frame should query the
|
||||||
@@ -4384,7 +4385,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
|
|||||||
* values. The orientation value may need to change depending on the specific folding
|
* values. The orientation value may need to change depending on the specific folding
|
||||||
* state. Information about the mapping between the device folding state and the
|
* state. Information about the mapping between the device folding state and the
|
||||||
* sensor orientation can be obtained in
|
* sensor orientation can be obtained in
|
||||||
* {@link android.hardware.camera2.params.DeviceStateOrientationMap }.
|
* {@link android.hardware.camera2.params.DeviceStateSensorOrientationMap }.
|
||||||
* Device state orientation maps are optional and maybe present on devices that support
|
* Device state orientation maps are optional and maybe present on devices that support
|
||||||
* {@link CaptureRequest#SCALER_ROTATE_AND_CROP android.scaler.rotateAndCrop}.</p>
|
* {@link CaptureRequest#SCALER_ROTATE_AND_CROP android.scaler.rotateAndCrop}.</p>
|
||||||
* <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
|
* <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
|
||||||
@@ -4398,8 +4399,8 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
|
|||||||
@PublicKey
|
@PublicKey
|
||||||
@NonNull
|
@NonNull
|
||||||
@SyntheticKey
|
@SyntheticKey
|
||||||
public static final Key<android.hardware.camera2.params.DeviceStateOrientationMap> INFO_DEVICE_STATE_ORIENTATION_MAP =
|
public static final Key<android.hardware.camera2.params.DeviceStateSensorOrientationMap> INFO_DEVICE_STATE_SENSOR_ORIENTATION_MAP =
|
||||||
new Key<android.hardware.camera2.params.DeviceStateOrientationMap>("android.info.deviceStateOrientationMap", android.hardware.camera2.params.DeviceStateOrientationMap.class);
|
new Key<android.hardware.camera2.params.DeviceStateSensorOrientationMap>("android.info.deviceStateSensorOrientationMap", android.hardware.camera2.params.DeviceStateSensorOrientationMap.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>HAL must populate the array with
|
* <p>HAL must populate the array with
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import android.hardware.ICameraServiceListener;
|
|||||||
import android.hardware.camera2.impl.CameraDeviceImpl;
|
import android.hardware.camera2.impl.CameraDeviceImpl;
|
||||||
import android.hardware.camera2.impl.CameraInjectionSessionImpl;
|
import android.hardware.camera2.impl.CameraInjectionSessionImpl;
|
||||||
import android.hardware.camera2.impl.CameraMetadataNative;
|
import android.hardware.camera2.impl.CameraMetadataNative;
|
||||||
import android.hardware.camera2.params.DeviceStateOrientationMap;
|
|
||||||
import android.hardware.camera2.params.ExtensionSessionConfiguration;
|
import android.hardware.camera2.params.ExtensionSessionConfiguration;
|
||||||
import android.hardware.camera2.params.SessionConfiguration;
|
import android.hardware.camera2.params.SessionConfiguration;
|
||||||
import android.hardware.camera2.params.StreamConfiguration;
|
import android.hardware.camera2.params.StreamConfiguration;
|
||||||
|
|||||||
@@ -50,11 +50,10 @@ import android.hardware.camera2.marshal.impl.MarshalQueryableStreamConfiguration
|
|||||||
import android.hardware.camera2.marshal.impl.MarshalQueryableStreamConfigurationDuration;
|
import android.hardware.camera2.marshal.impl.MarshalQueryableStreamConfigurationDuration;
|
||||||
import android.hardware.camera2.marshal.impl.MarshalQueryableString;
|
import android.hardware.camera2.marshal.impl.MarshalQueryableString;
|
||||||
import android.hardware.camera2.params.Capability;
|
import android.hardware.camera2.params.Capability;
|
||||||
import android.hardware.camera2.params.DeviceStateOrientationMap;
|
import android.hardware.camera2.params.DeviceStateSensorOrientationMap;
|
||||||
import android.hardware.camera2.params.Face;
|
import android.hardware.camera2.params.Face;
|
||||||
import android.hardware.camera2.params.HighSpeedVideoConfiguration;
|
import android.hardware.camera2.params.HighSpeedVideoConfiguration;
|
||||||
import android.hardware.camera2.params.LensShadingMap;
|
import android.hardware.camera2.params.LensShadingMap;
|
||||||
import android.hardware.camera2.params.MeteringRectangle;
|
|
||||||
import android.hardware.camera2.params.MandatoryStreamCombination;
|
import android.hardware.camera2.params.MandatoryStreamCombination;
|
||||||
import android.hardware.camera2.params.MultiResolutionStreamConfigurationMap;
|
import android.hardware.camera2.params.MultiResolutionStreamConfigurationMap;
|
||||||
import android.hardware.camera2.params.OisSample;
|
import android.hardware.camera2.params.OisSample;
|
||||||
@@ -763,7 +762,7 @@ public class CameraMetadataNative implements Parcelable {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
sGetCommandMap.put(
|
sGetCommandMap.put(
|
||||||
CameraCharacteristics.INFO_DEVICE_STATE_ORIENTATION_MAP.getNativeKey(),
|
CameraCharacteristics.INFO_DEVICE_STATE_SENSOR_ORIENTATION_MAP.getNativeKey(),
|
||||||
new GetCommand() {
|
new GetCommand() {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -1004,7 +1003,7 @@ public class CameraMetadataNative implements Parcelable {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DeviceStateOrientationMap getDeviceStateOrientationMap() {
|
private DeviceStateSensorOrientationMap getDeviceStateOrientationMap() {
|
||||||
long[] mapArray = getBase(CameraCharacteristics.INFO_DEVICE_STATE_ORIENTATIONS);
|
long[] mapArray = getBase(CameraCharacteristics.INFO_DEVICE_STATE_ORIENTATIONS);
|
||||||
|
|
||||||
// Do not warn if map is null while s is not. This is valid.
|
// Do not warn if map is null while s is not. This is valid.
|
||||||
@@ -1012,7 +1011,7 @@ public class CameraMetadataNative implements Parcelable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceStateOrientationMap map = new DeviceStateOrientationMap(mapArray);
|
DeviceStateSensorOrientationMap map = new DeviceStateSensorOrientationMap(mapArray);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import java.util.Objects;
|
|||||||
*
|
*
|
||||||
* @see CameraCharacteristics#SENSOR_ORIENTATION
|
* @see CameraCharacteristics#SENSOR_ORIENTATION
|
||||||
*/
|
*/
|
||||||
public final class DeviceStateOrientationMap {
|
public final class DeviceStateSensorOrientationMap {
|
||||||
/**
|
/**
|
||||||
* Needs to be kept in sync with the HIDL/AIDL DeviceState
|
* Needs to be kept in sync with the HIDL/AIDL DeviceState
|
||||||
*/
|
*/
|
||||||
@@ -85,10 +85,10 @@ public final class DeviceStateOrientationMap {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public DeviceStateOrientationMap(final long[] elements) {
|
public DeviceStateSensorOrientationMap(final long[] elements) {
|
||||||
mElements = Objects.requireNonNull(elements, "elements must not be null");
|
mElements = Objects.requireNonNull(elements, "elements must not be null");
|
||||||
if ((elements.length % 2) != 0) {
|
if ((elements.length % 2) != 0) {
|
||||||
throw new IllegalArgumentException("Device state orientation map length " +
|
throw new IllegalArgumentException("Device state sensor orientation map length " +
|
||||||
elements.length + " is not even!");
|
elements.length + " is not even!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,8 @@ public final class DeviceStateOrientationMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if this DeviceStateOrientationMap is equal to another DeviceStateOrientationMap.
|
* Check if this DeviceStateSensorOrientationMap is equal to another
|
||||||
|
* DeviceStateSensorOrientationMap.
|
||||||
*
|
*
|
||||||
* <p>Two device state orientation maps are equal if and only if all of their elements are
|
* <p>Two device state orientation maps are equal if and only if all of their elements are
|
||||||
* {@link Object#equals equal}.</p>
|
* {@link Object#equals equal}.</p>
|
||||||
@@ -136,8 +137,8 @@ public final class DeviceStateOrientationMap {
|
|||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj instanceof DeviceStateOrientationMap) {
|
if (obj instanceof DeviceStateSensorOrientationMap) {
|
||||||
final DeviceStateOrientationMap other = (DeviceStateOrientationMap) obj;
|
final DeviceStateSensorOrientationMap other = (DeviceStateSensorOrientationMap) obj;
|
||||||
return Arrays.equals(mElements, other.mElements);
|
return Arrays.equals(mElements, other.mElements);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
Reference in New Issue
Block a user