diff --git a/Android.bp b/Android.bp
index 9937b9853606b00a67024e27085f02bfb4119af3..60f0ff1b7382a939472975b5329db64ae171326c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,18 +1,3 @@
-//
-// Copyright (C) 2021 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE
// CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
// DEPENDING ON IT IN YOUR PROJECT. ***
@@ -48,3 +33,66 @@ license {
"NOTICE",
],
}
+
+aidl_interface {
+ name: "av-types-aidl",
+ unstable: true,
+ host_supported: true,
+ vendor_available: true,
+ double_loadable: true,
+ local_include_dir: "aidl",
+ srcs: [
+ "aidl/android/media/InterpolatorConfig.aidl",
+ "aidl/android/media/InterpolatorType.aidl",
+ "aidl/android/media/MicrophoneInfoData.aidl",
+ "aidl/android/media/VolumeShaperConfiguration.aidl",
+ "aidl/android/media/VolumeShaperConfigurationOptionFlag.aidl",
+ "aidl/android/media/VolumeShaperConfigurationType.aidl",
+ "aidl/android/media/VolumeShaperOperation.aidl",
+ "aidl/android/media/VolumeShaperOperationFlag.aidl",
+ "aidl/android/media/VolumeShaperState.aidl",
+ ],
+ backend: {
+ cpp: {
+ min_sdk_version: "29",
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.bluetooth.updatable",
+ "com.android.media",
+ "com.android.media.swcodec",
+ ],
+ },
+ },
+}
+
+cc_library_headers {
+ name: "av-headers",
+ export_include_dirs: ["include"],
+ static_libs: [
+ "av-types-aidl-cpp",
+ ],
+ export_static_lib_headers: [
+ "av-types-aidl-cpp",
+ ],
+ header_libs: [
+ "libaudioclient_aidl_conversion_util",
+ ],
+ export_header_lib_headers: [
+ "libaudioclient_aidl_conversion_util",
+ ],
+ host_supported: true,
+ vendor_available: true,
+ double_loadable: true,
+ min_sdk_version: "29",
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.bluetooth.updatable",
+ "com.android.media",
+ "com.android.media.swcodec",
+ ],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
diff --git a/MainlineFiles.cfg b/MainlineFiles.cfg
index 37d714c371a68d22e575d29bee6da2081fe2a79c..490bbbf32293751a275fd92307ce53fbe9848a72 100644
--- a/MainlineFiles.cfg
+++ b/MainlineFiles.cfg
@@ -1,10 +1,13 @@
-#
+#
# mainline files for frameworks/av
+# this list used by tools/mainline_hook_*.sh to help separate
+# mainline changes vs framework changes, which release at different paces.
+#
#
# ignore comment (#) lines and blank lines
# rest are path prefixes starting at root of the project
# (so OWNERS, not frameworks/av/OWNERS)
-#
+#
# path
# INCLUDE path
# EXCLUDE path
@@ -24,11 +27,5 @@
media/codec2/components/
media/codecs/
media/extractors/
-media/libstagefright/codecs/amrnb/
-media/libstagefright/codecs/amrwb/
-media/libstagefright/codecs/amrwbenc/
-media/libstagefright/codecs/common/
-media/libstagefright/codecs/flac/
-media/libstagefright/codecs/m4v_h263/
-media/libstagefright/codecs/mp3dec/
-media/libstagefright/mpeg2ts
+media/libstagefright/mpeg2ts/
+media/libstagefright/flac/
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index b1c81bf4c537a999e35846286066175cded15c9c..716b55053952f318e16ea63fa75a85aaaeb0abf4 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -3,3 +3,11 @@ mainline_hook = ${REPO_ROOT}/frameworks/av/tools/mainline_hook_partial.sh ${REPO
hidden_api_txt_checksorted_hook = ${REPO_ROOT}/tools/platform-compat/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT}
+[Builtin Hooks]
+clang_format = true
+
+[Builtin Hooks Options]
+# Only turn on clang-format check for the following subfolders.
+clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp
+ media/libmediatranscoding/
+ services/mediatranscoding/
diff --git a/aidl/android/media/InterpolatorConfig.aidl b/aidl/android/media/InterpolatorConfig.aidl
new file mode 100644
index 0000000000000000000000000000000000000000..49f90e8e3d7bd34c0c412c20f7dfbde3d79184c3
--- /dev/null
+++ b/aidl/android/media/InterpolatorConfig.aidl
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.media;
+
+import android.media.InterpolatorType;
+
+/**
+ * {@hide}
+ */
+parcelable InterpolatorConfig {
+ InterpolatorType type = InterpolatorType.CUBIC;
+ /** For cubic interpolation, the boundary conditions in slope. */
+ float firstSlope;
+ float lastSlope;
+ /** A flattened list of pairs, monotonically increasing in x. */
+ float[] xy;
+}
diff --git a/aidl/android/media/InterpolatorType.aidl b/aidl/android/media/InterpolatorType.aidl
new file mode 100644
index 0000000000000000000000000000000000000000..b722cadcf1cdbc265d4bc0d089a4748627df4428
--- /dev/null
+++ b/aidl/android/media/InterpolatorType.aidl
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.media;
+
+/**
+ * Polynomial spline interpolators.
+ *
+ * {@hide}
+ */
+@Backing(type="int")
+enum InterpolatorType {
+ /** Not continuous. */
+ STEP,
+ /** C0. */
+ LINEAR,
+ /** C1. */
+ CUBIC,
+ /** C1 (to provide locally monotonic curves). */
+ CUBIC_MONOTONIC,
+ // CUBIC_C2, // TODO - requires global computation / cache
+}
diff --git a/aidl/android/media/MicrophoneInfoData.aidl b/aidl/android/media/MicrophoneInfoData.aidl
new file mode 100644
index 0000000000000000000000000000000000000000..747bfa58100549e616d0661599101d787751683b
--- /dev/null
+++ b/aidl/android/media/MicrophoneInfoData.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.media;
+
+/**
+ * {@hide}
+ */
+parcelable MicrophoneInfoData {
+ @utf8InCpp String deviceId;
+ int portId;
+ int type;
+ @utf8InCpp String address;
+ int deviceLocation;
+ int deviceGroup;
+ int indexInTheGroup;
+ float[] geometricLocation;
+ float[] orientation;
+ float[] frequencies;
+ float[] frequencyResponses;
+ int[] channelMapping;
+ float sensitivity;
+ float maxSpl;
+ float minSpl;
+ int directionality;
+}
diff --git a/aidl/android/media/VolumeShaperConfiguration.aidl b/aidl/android/media/VolumeShaperConfiguration.aidl
new file mode 100644
index 0000000000000000000000000000000000000000..d6e65053209c948debc86a090d48ae8b5344e286
--- /dev/null
+++ b/aidl/android/media/VolumeShaperConfiguration.aidl
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.media;
+
+import android.media.InterpolatorConfig;
+import android.media.VolumeShaperConfigurationOptionFlag;
+import android.media.VolumeShaperConfigurationType;
+
+/**
+ * {@hide}
+ */
+parcelable VolumeShaperConfiguration {
+ VolumeShaperConfigurationType type = VolumeShaperConfigurationType.ID;
+ int id;
+ /** Bitmask, indexed by VolumeShaperConfigurationOptionFlag. */
+ int optionFlags;
+ double durationMs;
+ @nullable InterpolatorConfig interpolatorConfig; // null if type == ID
+}
diff --git a/aidl/android/media/VolumeShaperConfigurationOptionFlag.aidl b/aidl/android/media/VolumeShaperConfigurationOptionFlag.aidl
new file mode 100644
index 0000000000000000000000000000000000000000..f583ceeaca25162502b611a781dc629dfbcdfadb
--- /dev/null
+++ b/aidl/android/media/VolumeShaperConfigurationOptionFlag.aidl
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.media;
+
+@Backing(type="int")
+enum VolumeShaperConfigurationOptionFlag {
+ VOLUME_IN_DBFS,
+ CLOCK_TIME,
+}
diff --git a/media/libaudioclient/aidl/android/media/VolumeShaper/Configuration.aidl b/aidl/android/media/VolumeShaperConfigurationType.aidl
similarity index 78%
rename from media/libaudioclient/aidl/android/media/VolumeShaper/Configuration.aidl
rename to aidl/android/media/VolumeShaperConfigurationType.aidl
index fd0e60f5b74bffb87854a532bcf49261c8bddeb3..aa6334ec8449af2ccb252cf5975e559c9c8edc0e 100644
--- a/media/libaudioclient/aidl/android/media/VolumeShaper/Configuration.aidl
+++ b/aidl/android/media/VolumeShaperConfigurationType.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,7 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package android.media;
-package android.media.VolumeShaper;
-
-parcelable Configuration cpp_header "media/VolumeShaper.h";
+@Backing(type="int")
+enum VolumeShaperConfigurationType {
+ ID,
+ SCALE,
+}
diff --git a/aidl/android/media/VolumeShaperOperation.aidl b/aidl/android/media/VolumeShaperOperation.aidl
new file mode 100644
index 0000000000000000000000000000000000000000..dd9a0e7a8b94fa192921e7f588f74a7b936e0bf8
--- /dev/null
+++ b/aidl/android/media/VolumeShaperOperation.aidl
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.media;
+
+/**
+ * {@hide}
+ */
+parcelable VolumeShaperOperation {
+ /** Operations to do. Bitmask of VolumeShaperOperationFlag. */
+ int flags;
+ /** If >= 0 the id to remove in a replace operation. */
+ int replaceId;
+ /** Position in the curve to set if a valid number (not nan). */
+ float xOffset;
+}
diff --git a/aidl/android/media/VolumeShaperOperationFlag.aidl b/aidl/android/media/VolumeShaperOperationFlag.aidl
new file mode 100644
index 0000000000000000000000000000000000000000..8fe5275f042faf4b986ca49e16a5f252264017d0
--- /dev/null
+++ b/aidl/android/media/VolumeShaperOperationFlag.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.media;
+
+@Backing(type="int")
+enum VolumeShaperOperationFlag {
+ /** The absence of this flag indicates "play". */
+ REVERSE,
+ TERMINATE,
+ JOIN,
+ DELAY,
+ CREATE_IF_NECESSARY,
+}
diff --git a/aidl/android/media/VolumeShaperState.aidl b/aidl/android/media/VolumeShaperState.aidl
new file mode 100644
index 0000000000000000000000000000000000000000..4085e2b0af723cbd67bc7bf995a1f2b6ad32d9f6
--- /dev/null
+++ b/aidl/android/media/VolumeShaperState.aidl
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.media;
+
+/**
+ * {@hide}
+ */
+parcelable VolumeShaperState {
+ /** Linear volume in the range MIN_LINEAR_VOLUME to MAX_LINEAR_VOLUME. */
+ float volume;
+ /** Position on curve expressed from MIN_CURVE_TIME to MAX_CURVE_TIME. */
+ float xOffset;
+}
diff --git a/apex/Android.bp b/apex/Android.bp
index 85fc7c97d3b9e12ab176a0e312d78a8ef0f7ab7b..b9abd1282fc3e0db4806bd4329e3f2e359325cd9 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -25,6 +25,7 @@ apex_defaults {
name: "com.android.media-defaults",
updatable: true,
bootclasspath_fragments: ["com.android.media-bootclasspath-fragment"],
+ systemserverclasspath_fragments: ["com.android.media-systemserverclasspath-fragment"],
multilib: {
first: {
// Extractor process runs only with the primary ABI.
@@ -40,15 +41,25 @@ apex_defaults {
"libmpeg2extractor",
"liboggextractor",
"libwavextractor",
- // JNI
- "libmediaparser-jni"
+ ],
+ // Transcoding service only run with primary ABI.
+ binaries: [
+ "mediatranscoding",
],
},
},
+ // JNI
+ native_shared_libs: [
+ "libmediaparser-jni",
+ "libmediaformatshaper",
+ ],
+ compile_multilib: "both",
prebuilts: [
- "mediaextractor.policy",
"code_coverage.policy",
+ "com.android.media-mediatranscoding.rc",
"crash_dump.policy",
+ "mediaextractor.policy",
+ "media-linker-config",
],
key: "com.android.media.key",
certificate: ":com.android.media.certificate",
@@ -73,10 +84,7 @@ apex {
name: "com.android.media",
manifest: "manifest.json",
defaults: ["com.android.media-defaults"],
- prebuilts: [
- "current_sdkinfo",
- "media-linker-config",
- ],
+ prebuilts: ["current_sdkinfo"],
}
linker_config {
@@ -121,6 +129,13 @@ bootclasspath_fragment {
},
}
+// Encapsulate the contributions made by the com.android.media to the systemserverclasspath.
+systemserverclasspath_fragment {
+ name: "com.android.media-systemserverclasspath-fragment",
+ contents: ["service-media-s"],
+ apex_available: ["com.android.media"],
+}
+
filegroup {
name: "com.android.media-androidManifest",
srcs: ["AndroidManifest-media.xml"],
@@ -137,6 +152,12 @@ apex_defaults {
binaries: [
"mediaswcodec",
],
+ native_shared_libs: [
+ "libcodec2_hidl@1.0",
+ "libcodec2_hidl@1.1",
+ "libcodec2_hidl@1.2",
+ "libstagefright_foundation",
+ ],
prebuilts: [
"com.android.media.swcodec-mediaswcodec.rc",
"com.android.media.swcodec-ld.config.txt",
@@ -145,7 +166,6 @@ apex_defaults {
"crash_dump.policy",
"mediaswcodec.xml",
],
- use_vendor: true,
key: "com.android.media.swcodec.key",
certificate: ":com.android.media.swcodec.certificate",
@@ -165,6 +185,13 @@ apex_defaults {
compressible: true,
}
+prebuilt_etc {
+ name: "com.android.media-mediatranscoding.rc",
+ src: "mediatranscoding.rc",
+ filename: "init.rc",
+ installable: false,
+}
+
prebuilt_etc {
name: "com.android.media.swcodec-mediaswcodec.rc",
src: "mediaswcodec.rc",
diff --git a/apex/TEST_MAPPING b/apex/TEST_MAPPING
index f036516acef66ae0431f95d8db00ab9ea79d7cac..4b7c0195a9a01324f3129e12dc1e86981158f46b 100644
--- a/apex/TEST_MAPPING
+++ b/apex/TEST_MAPPING
@@ -14,17 +14,9 @@
},
{
"include-filter": "com.google.android.media.gts.WidevineGenericOpsTests"
- }
- ]
- },
- {
- "name": "GtsExoPlayerTestCases",
- "options" : [
- {
- "include-annotation": "android.platform.test.annotations.SocPresubmit"
},
{
- "include-filter": "com.google.android.exoplayer.gts.DashTest#testWidevine23FpsH264Fixed"
+ "include-filter": "com.google.android.media.gts.WidevineH264PlaybackTests"
}
]
}
diff --git a/apex/manifest.json b/apex/manifest.json
index ddd642ed3c13c536733155ca5a6b9f9c51d87caf..5d72031d2d655a017f84d712a366ef9305822788 100644
--- a/apex/manifest.json
+++ b/apex/manifest.json
@@ -1,4 +1,10 @@
{
"name": "com.android.media",
- "version": 300000000
+ "version": 319999900,
+ "requireNativeLibs": [
+ "libandroid.so",
+ "libbinder_ndk.so",
+ "libmediandk.so",
+ ":sphal"
+ ]
}
diff --git a/apex/manifest_codec.json b/apex/manifest_codec.json
index 1f05d2eeb42707a968cc039db508b1d76c784efe..b0d962d6cc76e34112c5492606985e2aaf4dd35a 100644
--- a/apex/manifest_codec.json
+++ b/apex/manifest_codec.json
@@ -1,6 +1,6 @@
{
"name": "com.android.media.swcodec",
- "version": 300000000,
+ "version": 319999900,
"requireNativeLibs": [
":sphal"
]
diff --git a/apex/mediaswcodec.rc b/apex/mediaswcodec.rc
index d17481bf98ac5ae732422eaf86e623674834f564..0c9b8c8cfe219f75f0b47a61d9c5e79e3e6e5a34 100644
--- a/apex/mediaswcodec.rc
+++ b/apex/mediaswcodec.rc
@@ -2,6 +2,5 @@ service media.swcodec /apex/com.android.media.swcodec/bin/mediaswcodec
class main
user mediacodec
group camera drmrpc mediadrm
- override
ioprio rt 4
writepid /dev/cpuset/foreground/tasks
diff --git a/apex/mediatranscoding.rc b/apex/mediatranscoding.rc
new file mode 100644
index 0000000000000000000000000000000000000000..ae9f8baac605fe6d9b15b6d1867fe43bfdbf1a60
--- /dev/null
+++ b/apex/mediatranscoding.rc
@@ -0,0 +1,12 @@
+# media.transcoding service is defined on com.android.media apex which goes back
+# to API29, but we only want it started on API31+ devices. So we declare it as
+# "disabled" and start it explicitly on boot.
+service media.transcoding /apex/com.android.media/bin/mediatranscoding
+ class main
+ user media
+ group media
+ ioprio rt 4
+ # Restrict to little cores only with system-background cpuset.
+ writepid /dev/cpuset/system-background/tasks
+ interface aidl media.transcoding
+ disabled
diff --git a/apex/testing/Android.bp b/apex/testing/Android.bp
index 4ff4d063a1862aef9b63d842e28c9384b51b831b..8b810901b56d940709208e60fa94f7e071b61699 100644
--- a/apex/testing/Android.bp
+++ b/apex/testing/Android.bp
@@ -18,8 +18,6 @@ package {
// all of the 'license_kinds' from "frameworks_av_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
- // SPDX-license-identifier-MIT
- // SPDX-license-identifier-Unicode-DFS
default_applicable_licenses: ["frameworks_av_license"],
}
diff --git a/camera/Android.bp b/camera/Android.bp
index 93bc68de6e18ed9cd0c2223b8f3d7eee62c3caa4..6878c203698e3528d2bf9204eac323e745235c57 100644
--- a/camera/Android.bp
+++ b/camera/Android.bp
@@ -66,10 +66,10 @@ cc_library_shared {
"CameraParameters.cpp",
"CaptureResult.cpp",
"CameraParameters2.cpp",
+ "CameraSessionStats.cpp",
"ICamera.cpp",
"ICameraClient.cpp",
"ICameraRecordingProxy.cpp",
- "ICameraRecordingProxyListener.cpp",
"camera2/CaptureRequest.cpp",
"camera2/ConcurrentCamera.cpp",
"camera2/OutputConfiguration.cpp",
@@ -119,6 +119,8 @@ filegroup {
"aidl/android/hardware/camera2/ICameraDeviceCallbacks.aidl",
"aidl/android/hardware/camera2/ICameraDeviceUser.aidl",
"aidl/android/hardware/camera2/ICameraOfflineSession.aidl",
+ "aidl/android/hardware/camera2/ICameraInjectionCallback.aidl",
+ "aidl/android/hardware/camera2/ICameraInjectionSession.aidl",
],
path: "aidl",
}
diff --git a/camera/Camera.cpp b/camera/Camera.cpp
index 84d1d934e19fe2e8a4c1dd6b28768c84f18ed76e..604dbb8b17d456349afb634b019b319abb0f7529 100644
--- a/camera/Camera.cpp
+++ b/camera/Camera.cpp
@@ -25,7 +25,6 @@
#include
#include
-#include
#include
#include
@@ -72,66 +71,10 @@ Camera::~Camera()
}
sp Camera::connect(int cameraId, const String16& clientPackageName,
- int clientUid, int clientPid)
+ int clientUid, int clientPid, int targetSdkVersion)
{
- return CameraBaseT::connect(cameraId, clientPackageName, clientUid, clientPid);
-}
-
-status_t Camera::connectLegacy(int cameraId, int halVersion,
- const String16& clientPackageName,
- int clientUid,
- sp& camera)
-{
- ALOGV("%s: connect legacy camera device", __FUNCTION__);
- sp c = new Camera(cameraId);
- sp<::android::hardware::ICameraClient> cl = c;
- status_t status = NO_ERROR;
- const sp<::android::hardware::ICameraService>& cs = CameraBaseT::getCameraService();
-
- binder::Status ret;
- if (cs != nullptr) {
- ret = cs.get()->connectLegacy(cl, cameraId, halVersion, clientPackageName,
- clientUid, /*out*/&(c->mCamera));
- }
- if (ret.isOk() && c->mCamera != nullptr) {
- IInterface::asBinder(c->mCamera)->linkToDeath(c);
- c->mStatus = NO_ERROR;
- camera = c;
- } else {
- switch(ret.serviceSpecificErrorCode()) {
- case hardware::ICameraService::ERROR_DISCONNECTED:
- status = -ENODEV;
- break;
- case hardware::ICameraService::ERROR_CAMERA_IN_USE:
- status = -EBUSY;
- break;
- case hardware::ICameraService::ERROR_INVALID_OPERATION:
- status = -EINVAL;
- break;
- case hardware::ICameraService::ERROR_MAX_CAMERAS_IN_USE:
- status = -EUSERS;
- break;
- case hardware::ICameraService::ERROR_ILLEGAL_ARGUMENT:
- status = BAD_VALUE;
- break;
- case hardware::ICameraService::ERROR_DEPRECATED_HAL:
- status = -EOPNOTSUPP;
- break;
- case hardware::ICameraService::ERROR_DISABLED:
- status = -EACCES;
- break;
- case hardware::ICameraService::ERROR_PERMISSION_DENIED:
- status = PERMISSION_DENIED;
- break;
- default:
- status = -EINVAL;
- ALOGW("An error occurred while connecting to camera %d: %s", cameraId,
- (cs != nullptr) ? "Service not available" : ret.toString8().string());
- break;
- }
- c.clear();
- }
- return status;
+ return CameraBaseT::connect(cameraId, clientPackageName, clientUid,
+ clientPid, targetSdkVersion);
}
status_t Camera::reconnect()
@@ -214,10 +157,6 @@ void Camera::stopPreview()
void Camera::stopRecording()
{
ALOGV("stopRecording");
- {
- Mutex::Autolock _l(mLock);
- mRecordingProxyListener.clear();
- }
sp <::android::hardware::ICamera> c = mCamera;
if (c == 0) return;
c->stopRecording();
@@ -325,12 +264,6 @@ void Camera::setListener(const sp& listener)
mListener = listener;
}
-void Camera::setRecordingProxyListener(const sp& listener)
-{
- Mutex::Autolock _l(mLock);
- mRecordingProxyListener = listener;
-}
-
void Camera::setPreviewCallbackFlags(int flag)
{
ALOGV("setPreviewCallbackFlags");
@@ -384,19 +317,6 @@ void Camera::dataCallback(int32_t msgType, const sp& dataPtr,
// callback from camera service when timestamped frame is ready
void Camera::dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp& dataPtr)
{
- // If recording proxy listener is registered, forward the frame and return.
- // The other listener (mListener) is ignored because the receiver needs to
- // call releaseRecordingFrame.
- sp proxylistener;
- {
- Mutex::Autolock _l(mLock);
- proxylistener = mRecordingProxyListener;
- }
- if (proxylistener != NULL) {
- proxylistener->dataCallbackTimestamp(timestamp, msgType, dataPtr);
- return;
- }
-
sp listener;
{
Mutex::Autolock _l(mLock);
@@ -413,19 +333,6 @@ void Camera::dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<
void Camera::recordingFrameHandleCallbackTimestamp(nsecs_t timestamp, native_handle_t* handle)
{
- // If recording proxy listener is registered, forward the frame and return.
- // The other listener (mListener) is ignored because the receiver needs to
- // call releaseRecordingFrameHandle.
- sp proxylistener;
- {
- Mutex::Autolock _l(mLock);
- proxylistener = mRecordingProxyListener;
- }
- if (proxylistener != NULL) {
- proxylistener->recordingFrameHandleCallbackTimestamp(timestamp, handle);
- return;
- }
-
sp listener;
{
Mutex::Autolock _l(mLock);
@@ -444,19 +351,6 @@ void Camera::recordingFrameHandleCallbackTimestampBatch(
const std::vector& timestamps,
const std::vector& handles)
{
- // If recording proxy listener is registered, forward the frame and return.
- // The other listener (mListener) is ignored because the receiver needs to
- // call releaseRecordingFrameHandle.
- sp proxylistener;
- {
- Mutex::Autolock _l(mLock);
- proxylistener = mRecordingProxyListener;
- }
- if (proxylistener != NULL) {
- proxylistener->recordingFrameHandleCallbackTimestampBatch(timestamps, handles);
- return;
- }
-
sp listener;
{
Mutex::Autolock _l(mLock);
@@ -476,10 +370,9 @@ sp Camera::getRecordingProxy() {
return new RecordingProxy(this);
}
-status_t Camera::RecordingProxy::startRecording(const sp& listener)
+status_t Camera::RecordingProxy::startRecording()
{
ALOGV("RecordingProxy::startRecording");
- mCamera->setRecordingProxyListener(listener);
mCamera->reconnect();
return mCamera->startRecording();
}
@@ -490,23 +383,6 @@ void Camera::RecordingProxy::stopRecording()
mCamera->stopRecording();
}
-void Camera::RecordingProxy::releaseRecordingFrame(const sp& mem)
-{
- ALOGV("RecordingProxy::releaseRecordingFrame");
- mCamera->releaseRecordingFrame(mem);
-}
-
-void Camera::RecordingProxy::releaseRecordingFrameHandle(native_handle_t* handle) {
- ALOGV("RecordingProxy::releaseRecordingFrameHandle");
- mCamera->releaseRecordingFrameHandle(handle);
-}
-
-void Camera::RecordingProxy::releaseRecordingFrameHandleBatch(
- const std::vector& handles) {
- ALOGV("RecordingProxy::releaseRecordingFrameHandleBatch");
- mCamera->releaseRecordingFrameHandleBatch(handles);
-}
-
Camera::RecordingProxy::RecordingProxy(const sp& camera)
{
mCamera = camera;
diff --git a/camera/CameraBase.cpp b/camera/CameraBase.cpp
index 0b0f5846cf013d05206f614e9c21d19add822563..03439fdf72543f99529d3a6c3a0055214a861c53 100644
--- a/camera/CameraBase.cpp
+++ b/camera/CameraBase.cpp
@@ -152,7 +152,7 @@ const sp<::android::hardware::ICameraService> CameraBase::getC
template
sp CameraBase::connect(int cameraId,
const String16& clientPackageName,
- int clientUid, int clientPid)
+ int clientUid, int clientPid, int targetSdkVersion)
{
ALOGV("%s: connect", __FUNCTION__);
sp c = new TCam(cameraId);
@@ -163,7 +163,7 @@ sp CameraBase::connect(int cameraId,
if (cs != nullptr) {
TCamConnectService fnConnectService = TCamTraits::fnConnectService;
ret = (cs.get()->*fnConnectService)(cl, cameraId, clientPackageName, clientUid,
- clientPid, /*out*/ &c->mCamera);
+ clientPid, targetSdkVersion, /*out*/ &c->mCamera);
}
if (ret.isOk() && c->mCamera != nullptr) {
IInterface::asBinder(c->mCamera)->linkToDeath(c);
diff --git a/camera/CameraMetadata.cpp b/camera/CameraMetadata.cpp
index 024311f4afbf978300fae38d524d3d4777117c2b..a4ae71be2c6bb7fe008e5e08beb970d2602f4633 100644
--- a/camera/CameraMetadata.cpp
+++ b/camera/CameraMetadata.cpp
@@ -22,6 +22,7 @@
#include
#include
+#include
namespace android {
@@ -527,6 +528,8 @@ status_t CameraMetadata::resizeIfNeeded(size_t extraEntries, size_t extraData) {
mBuffer = allocate_camera_metadata(newEntryCount,
newDataCount);
if (mBuffer == NULL) {
+ // Maintain old buffer to avoid potential memory leak.
+ mBuffer = oldBuffer;
ALOGE("%s: Can't allocate larger metadata buffer", __FUNCTION__);
return NO_MEMORY;
}
@@ -877,5 +880,8 @@ status_t CameraMetadata::getTagFromName(const char *name,
return OK;
}
+metadata_vendor_id_t CameraMetadata::getVendorId() {
+ return get_camera_metadata_vendor_id(mBuffer);
+}
}; // namespace android
diff --git a/camera/CameraSessionStats.cpp b/camera/CameraSessionStats.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..28e037ff946a4f84290582969d7e5f7142289e50
--- /dev/null
+++ b/camera/CameraSessionStats.cpp
@@ -0,0 +1,428 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// #define LOG_NDEBUG 0
+#define LOG_TAG "CameraSessionStats"
+#include
+#include
+
+#include
+
+#include
+
+namespace android {
+namespace hardware {
+
+status_t CameraStreamStats::readFromParcel(const android::Parcel* parcel) {
+ if (parcel == NULL) {
+ ALOGE("%s: Null parcel", __FUNCTION__);
+ return BAD_VALUE;
+ }
+
+ status_t err = OK;
+
+ int width = 0;
+ if ((err = parcel->readInt32(&width)) != OK) {
+ ALOGE("%s: Failed to read width from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int height = 0;
+ if ((err = parcel->readInt32(&height)) != OK) {
+ ALOGE("%s: Failed to read height from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int format = 0;
+ if ((err = parcel->readInt32(&format)) != OK) {
+ ALOGE("%s: Failed to read format from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int dataSpace = 0;
+ if ((err = parcel->readInt32(&dataSpace)) != OK) {
+ ALOGE("%s: Failed to read dataSpace from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int64_t usage = 0;
+ if ((err = parcel->readInt64(&usage)) != OK) {
+ ALOGE("%s: Failed to read usage from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int64_t requestCount = 0;
+ if ((err = parcel->readInt64(&requestCount)) != OK) {
+ ALOGE("%s: Failed to read request count from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int64_t errorCount = 0;
+ if ((err = parcel->readInt64(&errorCount)) != OK) {
+ ALOGE("%s: Failed to read error count from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int startLatencyMs = 0;
+ if ((err = parcel->readInt32(&startLatencyMs)) != OK) {
+ ALOGE("%s: Failed to read start latency from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int maxHalBuffers = 0;
+ if ((err = parcel->readInt32(&maxHalBuffers)) != OK) {
+ ALOGE("%s: Failed to read max Hal buffers from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int maxAppBuffers = 0;
+ if ((err = parcel->readInt32(&maxAppBuffers)) != OK) {
+ ALOGE("%s: Failed to read max app buffers from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int histogramType = HISTOGRAM_TYPE_UNKNOWN;
+ if ((err = parcel->readInt32(&histogramType)) != OK) {
+ ALOGE("%s: Failed to read histogram type from parcel", __FUNCTION__);
+ return err;
+ }
+
+ std::vector histogramBins;
+ if ((err = parcel->readFloatVector(&histogramBins)) != OK) {
+ ALOGE("%s: Failed to read histogram bins from parcel", __FUNCTION__);
+ return err;
+ }
+
+ std::vector histogramCounts;
+ if ((err = parcel->readInt64Vector(&histogramCounts)) != OK) {
+ ALOGE("%s: Failed to read histogram counts from parcel", __FUNCTION__);
+ return err;
+ }
+
+ mWidth = width;
+ mHeight = height;
+ mFormat = format;
+ mDataSpace = dataSpace;
+ mUsage = usage;
+ mRequestCount = requestCount;
+ mErrorCount = errorCount;
+ mStartLatencyMs = startLatencyMs;
+ mMaxHalBuffers = maxHalBuffers;
+ mMaxAppBuffers = maxAppBuffers;
+ mHistogramType = histogramType;
+ mHistogramBins = std::move(histogramBins);
+ mHistogramCounts = std::move(histogramCounts);
+
+ return OK;
+}
+
+status_t CameraStreamStats::writeToParcel(android::Parcel* parcel) const {
+ if (parcel == NULL) {
+ ALOGE("%s: Null parcel", __FUNCTION__);
+ return BAD_VALUE;
+ }
+
+ status_t err = OK;
+
+ if ((err = parcel->writeInt32(mWidth)) != OK) {
+ ALOGE("%s: Failed to write stream width!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mHeight)) != OK) {
+ ALOGE("%s: Failed to write stream height!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mFormat)) != OK) {
+ ALOGE("%s: Failed to write stream format!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mDataSpace)) != OK) {
+ ALOGE("%s: Failed to write stream dataSpace!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt64(mUsage)) != OK) {
+ ALOGE("%s: Failed to write stream usage!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt64(mRequestCount)) != OK) {
+ ALOGE("%s: Failed to write stream request count!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt64(mErrorCount)) != OK) {
+ ALOGE("%s: Failed to write stream error count!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mStartLatencyMs)) != OK) {
+ ALOGE("%s: Failed to write stream start latency!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mMaxHalBuffers)) != OK) {
+ ALOGE("%s: Failed to write max hal buffers", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mMaxAppBuffers)) != OK) {
+ ALOGE("%s: Failed to write max app buffers", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mHistogramType)) != OK) {
+ ALOGE("%s: Failed to write histogram type", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeFloatVector(mHistogramBins)) != OK) {
+ ALOGE("%s: Failed to write histogram bins!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt64Vector(mHistogramCounts)) != OK) {
+ ALOGE("%s: Failed to write histogram counts!", __FUNCTION__);
+ return err;
+ }
+
+ return OK;
+}
+
+const int CameraSessionStats::CAMERA_STATE_OPEN = 0;
+const int CameraSessionStats::CAMERA_STATE_ACTIVE = 1;
+const int CameraSessionStats::CAMERA_STATE_IDLE = 2;
+const int CameraSessionStats::CAMERA_STATE_CLOSED = 3;
+
+const int CameraSessionStats::CAMERA_FACING_BACK = 0;
+const int CameraSessionStats::CAMERA_FACING_FRONT = 1;
+const int CameraSessionStats::CAMERA_FACING_EXTERNAL = 2;
+
+const int CameraSessionStats::CAMERA_API_LEVEL_1 = 1;
+const int CameraSessionStats::CAMERA_API_LEVEL_2 = 2;
+
+CameraSessionStats::CameraSessionStats() :
+ mFacing(CAMERA_FACING_BACK),
+ mNewCameraState(CAMERA_STATE_CLOSED),
+ mApiLevel(0),
+ mIsNdk(false),
+ mLatencyMs(-1),
+ mSessionType(0),
+ mInternalReconfigure(0),
+ mRequestCount(0),
+ mResultErrorCount(0),
+ mDeviceError(false) {}
+
+CameraSessionStats::CameraSessionStats(const String16& cameraId,
+ int facing, int newCameraState, const String16& clientName,
+ int apiLevel, bool isNdk, int32_t latencyMs) :
+ mCameraId(cameraId),
+ mFacing(facing),
+ mNewCameraState(newCameraState),
+ mClientName(clientName),
+ mApiLevel(apiLevel),
+ mIsNdk(isNdk),
+ mLatencyMs(latencyMs),
+ mSessionType(0),
+ mInternalReconfigure(0),
+ mRequestCount(0),
+ mResultErrorCount(0),
+ mDeviceError(0) {}
+
+status_t CameraSessionStats::readFromParcel(const android::Parcel* parcel) {
+ if (parcel == NULL) {
+ ALOGE("%s: Null parcel", __FUNCTION__);
+ return BAD_VALUE;
+ }
+
+ status_t err = OK;
+
+ String16 id;
+ if ((err = parcel->readString16(&id)) != OK) {
+ ALOGE("%s: Failed to read camera id!", __FUNCTION__);
+ return BAD_VALUE;
+ }
+
+ int facing = 0;
+ if ((err = parcel->readInt32(&facing)) != OK) {
+ ALOGE("%s: Failed to read camera facing from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int32_t newCameraState;
+ if ((err = parcel->readInt32(&newCameraState)) != OK) {
+ ALOGE("%s: Failed to read new camera state from parcel", __FUNCTION__);
+ return err;
+ }
+
+ String16 clientName;
+ if ((err = parcel->readString16(&clientName)) != OK) {
+ ALOGE("%s: Failed to read client name!", __FUNCTION__);
+ return BAD_VALUE;
+ }
+
+ int32_t apiLevel;
+ if ((err = parcel->readInt32(&apiLevel)) != OK) {
+ ALOGE("%s: Failed to read api level from parcel", __FUNCTION__);
+ return err;
+ }
+
+ bool isNdk;
+ if ((err = parcel->readBool(&isNdk)) != OK) {
+ ALOGE("%s: Failed to read isNdk flag from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int32_t latencyMs;
+ if ((err = parcel->readInt32(&latencyMs)) != OK) {
+ ALOGE("%s: Failed to read latencyMs from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int32_t sessionType;
+ if ((err = parcel->readInt32(&sessionType)) != OK) {
+ ALOGE("%s: Failed to read session type from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int32_t internalReconfigure;
+ if ((err = parcel->readInt32(&internalReconfigure)) != OK) {
+ ALOGE("%s: Failed to read internal reconfigure count from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int64_t requestCount;
+ if ((err = parcel->readInt64(&requestCount)) != OK) {
+ ALOGE("%s: Failed to read request count from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int64_t resultErrorCount;
+ if ((err = parcel->readInt64(&resultErrorCount)) != OK) {
+ ALOGE("%s: Failed to read result error count from parcel", __FUNCTION__);
+ return err;
+ }
+
+ bool deviceError;
+ if ((err = parcel->readBool(&deviceError)) != OK) {
+ ALOGE("%s: Failed to read device error flag from parcel", __FUNCTION__);
+ return err;
+ }
+
+ std::vector streamStats;
+ if ((err = parcel->readParcelableVector(&streamStats)) != OK) {
+ ALOGE("%s: Failed to read stream state from parcel", __FUNCTION__);
+ return err;
+ }
+
+ mCameraId = id;
+ mFacing = facing;
+ mNewCameraState = newCameraState;
+ mClientName = clientName;
+ mApiLevel = apiLevel;
+ mIsNdk = isNdk;
+ mLatencyMs = latencyMs;
+ mSessionType = sessionType;
+ mInternalReconfigure = internalReconfigure;
+ mRequestCount = requestCount;
+ mResultErrorCount = resultErrorCount;
+ mDeviceError = deviceError;
+ mStreamStats = std::move(streamStats);
+
+ return OK;
+}
+
+status_t CameraSessionStats::writeToParcel(android::Parcel* parcel) const {
+ if (parcel == NULL) {
+ ALOGE("%s: Null parcel", __FUNCTION__);
+ return BAD_VALUE;
+ }
+
+ status_t err = OK;
+
+ if ((err = parcel->writeString16(mCameraId)) != OK) {
+ ALOGE("%s: Failed to write camera id!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mFacing)) != OK) {
+ ALOGE("%s: Failed to write camera facing!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mNewCameraState)) != OK) {
+ ALOGE("%s: Failed to write new camera state!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeString16(mClientName)) != OK) {
+ ALOGE("%s: Failed to write client name!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mApiLevel)) != OK) {
+ ALOGE("%s: Failed to write api level!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeBool(mIsNdk)) != OK) {
+ ALOGE("%s: Failed to write isNdk flag!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mLatencyMs)) != OK) {
+ ALOGE("%s: Failed to write latency in Ms!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mSessionType)) != OK) {
+ ALOGE("%s: Failed to write session type!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt32(mInternalReconfigure)) != OK) {
+ ALOGE("%s: Failed to write internal reconfigure count!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt64(mRequestCount)) != OK) {
+ ALOGE("%s: Failed to write request count!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeInt64(mResultErrorCount)) != OK) {
+ ALOGE("%s: Failed to write result error count!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeBool(mDeviceError)) != OK) {
+ ALOGE("%s: Failed to write device error flag!", __FUNCTION__);
+ return err;
+ }
+
+ if ((err = parcel->writeParcelableVector(mStreamStats)) != OK) {
+ ALOGE("%s: Failed to write stream states!", __FUNCTION__);
+ return err;
+ }
+
+ return OK;
+}
+
+} // namespace hardware
+} // namesmpace android
diff --git a/camera/ICameraRecordingProxy.cpp b/camera/ICameraRecordingProxy.cpp
index bd6af75c0a142828b231200f2656b5d5e5ff6092..97523a52319c0aea3fa448012d7c7603073ba5dd 100644
--- a/camera/ICameraRecordingProxy.cpp
+++ b/camera/ICameraRecordingProxy.cpp
@@ -18,7 +18,6 @@
#define LOG_TAG "ICameraRecordingProxy"
#include
#include
-#include
#include
#include
#include
@@ -29,10 +28,7 @@ namespace android {
enum {
START_RECORDING = IBinder::FIRST_CALL_TRANSACTION,
- STOP_RECORDING,
- RELEASE_RECORDING_FRAME,
- RELEASE_RECORDING_FRAME_HANDLE,
- RELEASE_RECORDING_FRAME_HANDLE_BATCH,
+ STOP_RECORDING
};
@@ -44,12 +40,11 @@ public:
{
}
- status_t startRecording(const sp& listener)
+ status_t startRecording()
{
ALOGV("startRecording");
Parcel data, reply;
data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor());
- data.writeStrongBinder(IInterface::asBinder(listener));
remote()->transact(START_RECORDING, data, &reply);
return reply.readInt32();
}
@@ -61,46 +56,6 @@ public:
data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor());
remote()->transact(STOP_RECORDING, data, &reply);
}
-
- void releaseRecordingFrame(const sp& mem)
- {
- ALOGV("releaseRecordingFrame");
- Parcel data, reply;
- data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor());
- data.writeStrongBinder(IInterface::asBinder(mem));
- remote()->transact(RELEASE_RECORDING_FRAME, data, &reply);
- }
-
- void releaseRecordingFrameHandle(native_handle_t *handle) {
- ALOGV("releaseRecordingFrameHandle");
- Parcel data, reply;
- data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor());
- data.writeNativeHandle(handle);
-
- remote()->transact(RELEASE_RECORDING_FRAME_HANDLE, data, &reply);
-
- // Close the native handle because camera received a dup copy.
- native_handle_close(handle);
- native_handle_delete(handle);
- }
-
- void releaseRecordingFrameHandleBatch(const std::vector& handles) {
- ALOGV("releaseRecordingFrameHandleBatch");
- Parcel data, reply;
- data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor());
- uint32_t n = handles.size();
- data.writeUint32(n);
- for (auto& handle : handles) {
- data.writeNativeHandle(handle);
- }
- remote()->transact(RELEASE_RECORDING_FRAME_HANDLE_BATCH, data, &reply);
-
- // Close the native handle because camera received a dup copy.
- for (auto& handle : handles) {
- native_handle_close(handle);
- native_handle_delete(handle);
- }
- }
};
IMPLEMENT_META_INTERFACE(CameraRecordingProxy, "android.hardware.ICameraRecordingProxy");
@@ -114,9 +69,7 @@ status_t BnCameraRecordingProxy::onTransact(
case START_RECORDING: {
ALOGV("START_RECORDING");
CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
- sp listener =
- interface_cast(data.readStrongBinder());
- reply->writeInt32(startRecording(listener));
+ reply->writeInt32(startRecording());
return NO_ERROR;
} break;
case STOP_RECORDING: {
@@ -125,46 +78,6 @@ status_t BnCameraRecordingProxy::onTransact(
stopRecording();
return NO_ERROR;
} break;
- case RELEASE_RECORDING_FRAME: {
- ALOGV("RELEASE_RECORDING_FRAME");
- CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
- sp mem = interface_cast(data.readStrongBinder());
- releaseRecordingFrame(mem);
- return NO_ERROR;
- } break;
- case RELEASE_RECORDING_FRAME_HANDLE: {
- ALOGV("RELEASE_RECORDING_FRAME_HANDLE");
- CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
-
- // releaseRecordingFrameHandle will be responsble to close the native handle.
- releaseRecordingFrameHandle(data.readNativeHandle());
- return NO_ERROR;
- } break;
- case RELEASE_RECORDING_FRAME_HANDLE_BATCH: {
- ALOGV("RELEASE_RECORDING_FRAME_HANDLE_BATCH");
- CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
- uint32_t n = 0;
- status_t res = data.readUint32(&n);
- if (res != OK) {
- ALOGE("%s: Failed to read batch size: %s (%d)", __FUNCTION__, strerror(-res), res);
- return BAD_VALUE;
- }
- std::vector handles;
- handles.reserve(n);
- for (uint32_t i = 0; i < n; i++) {
- native_handle_t* handle = data.readNativeHandle();
- if (handle == nullptr) {
- ALOGE("%s: Received a null native handle at handles[%d]",
- __FUNCTION__, i);
- return BAD_VALUE;
- }
- handles.push_back(handle);
- }
-
- // releaseRecordingFrameHandleBatch will be responsble to close the native handle.
- releaseRecordingFrameHandleBatch(handles);
- return NO_ERROR;
- } break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
@@ -173,4 +86,3 @@ status_t BnCameraRecordingProxy::onTransact(
// ----------------------------------------------------------------------------
}; // namespace android
-
diff --git a/camera/ICameraRecordingProxyListener.cpp b/camera/ICameraRecordingProxyListener.cpp
deleted file mode 100644
index 66faf8fdd6082fa55f5e673484dd0f43933f869f..0000000000000000000000000000000000000000
--- a/camera/ICameraRecordingProxyListener.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "ICameraRecordingProxyListener"
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace android {
-
-enum {
- DATA_CALLBACK_TIMESTAMP = IBinder::FIRST_CALL_TRANSACTION,
- RECORDING_FRAME_HANDLE_CALLBACK_TIMESTAMP,
- RECORDING_FRAME_HANDLE_CALLBACK_TIMESTAMP_BATCH
-};
-
-class BpCameraRecordingProxyListener: public BpInterface
-{
-public:
- explicit BpCameraRecordingProxyListener(const sp& impl)
- : BpInterface(impl)
- {
- }
-
- void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp& imageData)
- {
- ALOGV("dataCallback");
- Parcel data, reply;
- data.writeInterfaceToken(ICameraRecordingProxyListener::getInterfaceDescriptor());
- data.writeInt64(timestamp);
- data.writeInt32(msgType);
- data.writeStrongBinder(IInterface::asBinder(imageData));
- remote()->transact(DATA_CALLBACK_TIMESTAMP, data, &reply, IBinder::FLAG_ONEWAY);
- }
-
- void recordingFrameHandleCallbackTimestamp(nsecs_t timestamp, native_handle_t* handle) {
- ALOGV("recordingFrameHandleCallbackTimestamp");
- Parcel data, reply;
- data.writeInterfaceToken(ICameraRecordingProxyListener::getInterfaceDescriptor());
- data.writeInt64(timestamp);
- data.writeNativeHandle(handle);
- remote()->transact(RECORDING_FRAME_HANDLE_CALLBACK_TIMESTAMP, data, &reply,
- IBinder::FLAG_ONEWAY);
-
- // The native handle is dupped in ICameraClient so we need to free it here.
- native_handle_close(handle);
- native_handle_delete(handle);
- }
-
- void recordingFrameHandleCallbackTimestampBatch(
- const std::vector& timestamps,
- const std::vector& handles) {
- ALOGV("recordingFrameHandleCallbackTimestampBatch");
- Parcel data, reply;
- data.writeInterfaceToken(ICameraRecordingProxyListener::getInterfaceDescriptor());
-
- uint32_t n = timestamps.size();
- if (n != handles.size()) {
- ALOGE("%s: size of timestamps(%zu) and handles(%zu) mismatch!",
- __FUNCTION__, timestamps.size(), handles.size());
- return;
- }
- data.writeUint32(n);
- for (auto ts : timestamps) {
- data.writeInt64(ts);
- }
- for (auto& handle : handles) {
- data.writeNativeHandle(handle);
- }
- remote()->transact(RECORDING_FRAME_HANDLE_CALLBACK_TIMESTAMP_BATCH, data, &reply,
- IBinder::FLAG_ONEWAY);
-
- // The native handle is dupped in ICameraClient so we need to free it here.
- for (auto& handle : handles) {
- native_handle_close(handle);
- native_handle_delete(handle);
- }
- }
-};
-
-IMPLEMENT_META_INTERFACE(CameraRecordingProxyListener, "android.hardware.ICameraRecordingProxyListener");
-
-// ----------------------------------------------------------------------
-
-status_t BnCameraRecordingProxyListener::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case DATA_CALLBACK_TIMESTAMP: {
- ALOGV("DATA_CALLBACK_TIMESTAMP");
- CHECK_INTERFACE(ICameraRecordingProxyListener, data, reply);
- nsecs_t timestamp = data.readInt64();
- int32_t msgType = data.readInt32();
- sp imageData = interface_cast(data.readStrongBinder());
- dataCallbackTimestamp(timestamp, msgType, imageData);
- return NO_ERROR;
- } break;
- case RECORDING_FRAME_HANDLE_CALLBACK_TIMESTAMP: {
- ALOGV("RECORDING_FRAME_HANDLE_CALLBACK_TIMESTAMP");
- CHECK_INTERFACE(ICameraRecordingProxyListener, data, reply);
- nsecs_t timestamp;
- status_t res = data.readInt64(×tamp);
- if (res != OK) {
- ALOGE("%s: Failed to read timestamp: %s (%d)", __FUNCTION__, strerror(-res), res);
- return BAD_VALUE;
- }
-
- native_handle_t* handle = data.readNativeHandle();
- if (handle == nullptr) {
- ALOGE("%s: Received a null native handle", __FUNCTION__);
- return BAD_VALUE;
- }
- // The native handle will be freed in
- // BpCameraRecordingProxy::releaseRecordingFrameHandle.
- recordingFrameHandleCallbackTimestamp(timestamp, handle);
- return NO_ERROR;
- } break;
- case RECORDING_FRAME_HANDLE_CALLBACK_TIMESTAMP_BATCH: {
- ALOGV("RECORDING_FRAME_HANDLE_CALLBACK_TIMESTAMP_BATCH");
- CHECK_INTERFACE(ICameraRecordingProxyListener, data, reply);
- uint32_t n = 0;
- status_t res = data.readUint32(&n);
- if (res != OK) {
- ALOGE("%s: Failed to read batch size: %s (%d)", __FUNCTION__, strerror(-res), res);
- return BAD_VALUE;
- }
- std::vector timestamps;
- std::vector handles;
- timestamps.reserve(n);
- handles.reserve(n);
- for (uint32_t i = 0; i < n; i++) {
- nsecs_t t;
- res = data.readInt64(&t);
- if (res != OK) {
- ALOGE("%s: Failed to read timestamp[%d]: %s (%d)",
- __FUNCTION__, i, strerror(-res), res);
- return BAD_VALUE;
- }
- timestamps.push_back(t);
- }
- for (uint32_t i = 0; i < n; i++) {
- native_handle_t* handle = data.readNativeHandle();
- if (handle == nullptr) {
- ALOGE("%s: Received a null native handle at handles[%d]",
- __FUNCTION__, i);
- return BAD_VALUE;
- }
- handles.push_back(handle);
- }
- // The native handle will be freed in
- // BpCameraRecordingProxy::releaseRecordingFrameHandleBatch.
- recordingFrameHandleCallbackTimestampBatch(timestamps, handles);
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
diff --git a/camera/TEST_MAPPING b/camera/TEST_MAPPING
new file mode 100644
index 0000000000000000000000000000000000000000..683e183d6dc0b9dc3bebed1f36a2344383010c82
--- /dev/null
+++ b/camera/TEST_MAPPING
@@ -0,0 +1,11 @@
+{
+ "postsubmit": [
+ {
+ "name": "CtsCameraTestCases"
+ },
+ {
+ "name": "CtsCameraTestCases",
+ "keywords": ["primary-device"]
+ }
+ ]
+}
diff --git a/camera/VendorTagDescriptor.cpp b/camera/VendorTagDescriptor.cpp
index d713d2dd86ad3744a7734abc13151fa169dfdaac..24fa912d53abf6c95eaf7d91511d29073f2c5673 100644
--- a/camera/VendorTagDescriptor.cpp
+++ b/camera/VendorTagDescriptor.cpp
@@ -660,6 +660,16 @@ sp VendorTagDescriptorCache::getGlobalVendorTagCache()
return sGlobalVendorTagDescriptorCache;
}
+bool VendorTagDescriptorCache::isVendorCachePresent(metadata_vendor_id_t vendorId) {
+ Mutex::Autolock al(sLock);
+ if ((sGlobalVendorTagDescriptorCache.get() != nullptr) &&
+ (sGlobalVendorTagDescriptorCache->getVendorIdsAndTagDescriptors().find(vendorId) !=
+ sGlobalVendorTagDescriptorCache->getVendorIdsAndTagDescriptors().end())) {
+ return true;
+ }
+ return false;
+}
+
extern "C" {
int vendor_tag_descriptor_get_tag_count(const vendor_tag_ops_t* /*v*/) {
diff --git a/camera/aidl/android/hardware/CameraSessionStats.aidl b/camera/aidl/android/hardware/CameraSessionStats.aidl
new file mode 100644
index 0000000000000000000000000000000000000000..a8e6774d0469c4aed35b60c07963fb996d8cf70d
--- /dev/null
+++ b/camera/aidl/android/hardware/CameraSessionStats.aidl
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware;
+
+/** @hide */
+parcelable CameraSessionStats cpp_header "camera/CameraSessionStats.h";
diff --git a/camera/aidl/android/hardware/ICameraService.aidl b/camera/aidl/android/hardware/ICameraService.aidl
index ac7a35b9f24245f7746b1b477b8b386b74321305..78a77d4ea1e0bc38109223949306beec23f6ea78 100644
--- a/camera/aidl/android/hardware/ICameraService.aidl
+++ b/camera/aidl/android/hardware/ICameraService.aidl
@@ -20,6 +20,8 @@ import android.hardware.ICamera;
import android.hardware.ICameraClient;
import android.hardware.camera2.ICameraDeviceUser;
import android.hardware.camera2.ICameraDeviceCallbacks;
+import android.hardware.camera2.ICameraInjectionCallback;
+import android.hardware.camera2.ICameraInjectionSession;
import android.hardware.camera2.params.VendorTagDescriptor;
import android.hardware.camera2.params.VendorTagDescriptorCache;
import android.hardware.camera2.utils.ConcurrentCameraIdCombination;
@@ -69,7 +71,7 @@ interface ICameraService
/**
* Default UID/PID values for non-privileged callers of
- * connect(), connectDevice(), and connectLegacy()
+ * connect() and connectDevice()
*/
const int USE_CALLING_UID = -1;
const int USE_CALLING_PID = -1;
@@ -80,7 +82,8 @@ interface ICameraService
ICamera connect(ICameraClient client,
int cameraId,
String opPackageName,
- int clientUid, int clientPid);
+ int clientUid, int clientPid,
+ int targetSdkVersion);
/**
* Open a camera device through the new camera API
@@ -90,21 +93,8 @@ interface ICameraService
String cameraId,
String opPackageName,
@nullable String featureId,
- int clientUid);
-
- /**
- * halVersion constant for connectLegacy
- */
- const int CAMERA_HAL_API_VERSION_UNSPECIFIED = -1;
-
- /**
- * Open a camera device in legacy mode, if supported by the camera module HAL.
- */
- ICamera connectLegacy(ICameraClient client,
- int cameraId,
- int halVersion,
- String opPackageName,
- int clientUid);
+ int clientUid, int oomScoreOffset,
+ int targetSdkVersion);
/**
* Add listener for changes to camera device and flashlight state.
@@ -126,13 +116,15 @@ interface ICameraService
* corresponding camera ids.
*
* @param sessions the set of camera id and session configuration pairs to be queried.
+ * @param targetSdkVersion the target sdk level of the application calling this function.
* @return true - the set of concurrent camera id and stream combinations is supported.
* false - the set of concurrent camera id and stream combinations is not supported
* OR the method was called with a set of camera ids not returned by
* getConcurrentCameraIds().
*/
boolean isConcurrentSessionConfigurationSupported(
- in CameraIdAndSessionConfiguration[] sessions);
+ in CameraIdAndSessionConfiguration[] sessions,
+ int targetSdkVersion);
/**
* Remove listener for changes to camera device and flashlight state.
@@ -143,7 +135,7 @@ interface ICameraService
* Read the static camera metadata for a camera device.
* Only supported for device HAL versions >= 3.2
*/
- CameraMetadataNative getCameraCharacteristics(String cameraId);
+ CameraMetadataNative getCameraCharacteristics(String cameraId, int targetSdkVersion);
/**
* Read in the vendor tag descriptors from the camera module HAL.
@@ -175,6 +167,9 @@ interface ICameraService
boolean supportsCameraApi(String cameraId, int apiVersion);
// Determines if a cameraId is a hidden physical camera of a logical multi-camera.
boolean isHiddenPhysicalCamera(String cameraId);
+ // Inject the external camera to replace the internal camera session.
+ ICameraInjectionSession injectCamera(String packageName, String internalCamId,
+ String externalCamId, in ICameraInjectionCallback CameraInjectionCallback);
void setTorchMode(String cameraId, boolean enabled, IBinder clientBinder);
@@ -187,6 +182,13 @@ interface ICameraService
const int EVENT_USER_SWITCHED = 1; // The argument is the set of new foreground user IDs.
oneway void notifySystemEvent(int eventId, in int[] args);
+ /**
+ * Notify the camera service of a display configuration change.
+ *
+ * Callers require the android.permission.CAMERA_SEND_SYSTEM_EVENTS permission.
+ */
+ oneway void notifyDisplayConfigurationChange();
+
/**
* Notify the camera service of a device physical status change. May only be called from
* a privileged process.
diff --git a/camera/aidl/android/hardware/ICameraServiceProxy.aidl b/camera/aidl/android/hardware/ICameraServiceProxy.aidl
index 75759489e774a04ce4607fc54b2d07167643d0dc..bbb02891f41c8ef30d4fb301c16927f83c41af79 100644
--- a/camera/aidl/android/hardware/ICameraServiceProxy.aidl
+++ b/camera/aidl/android/hardware/ICameraServiceProxy.aidl
@@ -16,11 +16,11 @@
package android.hardware;
+import android.hardware.CameraSessionStats;
+
/**
* Binder interface for the camera service proxy running in system_server.
*
- * Keep in sync with frameworks/av/include/camera/ICameraServiceProxy.h
- *
* @hide
*/
interface ICameraServiceProxy
@@ -30,30 +30,15 @@ interface ICameraServiceProxy
*/
oneway void pingForUserUpdate();
- /**
- * Values for notifyCameraState newCameraState
- */
- const int CAMERA_STATE_OPEN = 0;
- const int CAMERA_STATE_ACTIVE = 1;
- const int CAMERA_STATE_IDLE = 2;
- const int CAMERA_STATE_CLOSED = 3;
/**
- * Values for notifyCameraState facing
- */
- const int CAMERA_FACING_BACK = 0;
- const int CAMERA_FACING_FRONT = 1;
- const int CAMERA_FACING_EXTERNAL = 2;
-
- /**
- * Values for notifyCameraState api level
+ * Update the status of a camera device.
*/
- const int CAMERA_API_LEVEL_1 = 1;
- const int CAMERA_API_LEVEL_2 = 2;
+ oneway void notifyCameraState(in CameraSessionStats cameraSessionStats);
/**
- * Update the status of a camera device.
+ * Reports whether the top activity needs a rotate and crop override.
*/
- oneway void notifyCameraState(String cameraId, int facing, int newCameraState,
- String clientName, int apiLevel);
+ boolean isRotateAndCropOverrideNeeded(String packageName, int sensorOrientation,
+ int lensFacing);
}
diff --git a/camera/aidl/android/hardware/camera2/ICameraDeviceUser.aidl b/camera/aidl/android/hardware/camera2/ICameraDeviceUser.aidl
index b183ccc822360c016c677f2dc8214342fb239b4e..8e1fcc06ee7f3003f56fd74e78cbfa891be08c96 100644
--- a/camera/aidl/android/hardware/camera2/ICameraDeviceUser.aidl
+++ b/camera/aidl/android/hardware/camera2/ICameraDeviceUser.aidl
@@ -83,9 +83,11 @@ interface ICameraDeviceUser
* @param operatingMode The kind of session to create; either NORMAL_MODE or
* CONSTRAINED_HIGH_SPEED_MODE. Must be a non-negative value.
* @param sessionParams Session wide camera parameters
+ * @param startTimeMs The timestamp of session creation start, measured by
+ * SystemClock.uptimeMillis.
* @return a list of stream ids that can be used in offline mode via "switchToOffline"
*/
- int[] endConfigure(int operatingMode, in CameraMetadataNative sessionParams);
+ int[] endConfigure(int operatingMode, in CameraMetadataNative sessionParams, long startTimeMs);
/**
* Check whether a particular session configuration has camera device
@@ -117,10 +119,11 @@ interface ICameraDeviceUser
* @param width Width of the input buffers
* @param height Height of the input buffers
* @param format Format of the input buffers. One of HAL_PIXEL_FORMAT_*.
+ * @param isMultiResolution Whether the input stream supports variable resolution image.
*
* @return new stream ID
*/
- int createInputStream(int width, int height, int format);
+ int createInputStream(int width, int height, int format, boolean isMultiResolution);
/**
* Get the surface of the input stream.
diff --git a/camera/aidl/android/hardware/camera2/ICameraInjectionCallback.aidl b/camera/aidl/android/hardware/camera2/ICameraInjectionCallback.aidl
new file mode 100644
index 0000000000000000000000000000000000000000..9791352c2b99fa5543447e90fcf942de055d49e7
--- /dev/null
+++ b/camera/aidl/android/hardware/camera2/ICameraInjectionCallback.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.camera2;
+
+import android.hardware.camera2.ICameraInjectionSession;
+
+/**
+ * Binder interface used to call back the error state injected by the external camera,
+ * and camera service can be switched back to internal camera when binder signals process death.
+ *
+ * @hide
+ */
+interface ICameraInjectionCallback
+{
+ // Error codes for onInjectionError
+ // To indicate all invalid error codes
+ const int ERROR_INJECTION_INVALID_ERROR = -1;
+ // To indicate the camera injection session has encountered a fatal error, such as injection
+ // init failure, configure failure or injecting failure etc.
+ const int ERROR_INJECTION_SESSION = 0;
+ // To indicate the camera service has encountered a fatal error.
+ const int ERROR_INJECTION_SERVICE = 1;
+ // To indicate the injection camera does not support certain camera functions, such as
+ // unsupport stream format, no capture/record function or no multi-camera function etc.
+ // When this error occurs, the default processing is still in the inject state, and the app is
+ // notified to display an error message and a black screen.
+ const int ERROR_INJECTION_UNSUPPORTED = 2;
+
+ oneway void onInjectionError(int errorCode);
+}
diff --git a/camera/aidl/android/hardware/camera2/ICameraInjectionSession.aidl b/camera/aidl/android/hardware/camera2/ICameraInjectionSession.aidl
new file mode 100644
index 0000000000000000000000000000000000000000..c31c30bcad746312313938eda55a3fc166df6720
--- /dev/null
+++ b/camera/aidl/android/hardware/camera2/ICameraInjectionSession.aidl
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.camera2;
+
+/** @hide */
+interface ICameraInjectionSession
+{
+ oneway void stopInjection();
+}
diff --git a/camera/camera2/OutputConfiguration.cpp b/camera/camera2/OutputConfiguration.cpp
index 4e9b27d50dff44b38635b4625240e72514edf716..2bccd870b8a7cf9c28595748387f89cfab35e558 100644
--- a/camera/camera2/OutputConfiguration.cpp
+++ b/camera/camera2/OutputConfiguration.cpp
@@ -68,6 +68,14 @@ String16 OutputConfiguration::getPhysicalCameraId() const {
return mPhysicalCameraId;
}
+bool OutputConfiguration::isMultiResolution() const {
+ return mIsMultiResolution;
+}
+
+const std::vector &OutputConfiguration::getSensorPixelModesUsed() const {
+ return mSensorPixelModesUsed;
+}
+
OutputConfiguration::OutputConfiguration() :
mRotation(INVALID_ROTATION),
mSurfaceSetID(INVALID_SET_ID),
@@ -75,7 +83,8 @@ OutputConfiguration::OutputConfiguration() :
mWidth(0),
mHeight(0),
mIsDeferred(false),
- mIsShared(false) {
+ mIsShared(false),
+ mIsMultiResolution(false) {
}
OutputConfiguration::OutputConfiguration(const android::Parcel& parcel) :
@@ -145,6 +154,17 @@ status_t OutputConfiguration::readFromParcel(const android::Parcel* parcel) {
parcel->readString16(&mPhysicalCameraId);
+ int isMultiResolution = 0;
+ if ((err = parcel->readInt32(&isMultiResolution)) != OK) {
+ ALOGE("%s: Failed to read surface isMultiResolution flag from parcel", __FUNCTION__);
+ return err;
+ }
+
+ std::vector sensorPixelModesUsed;
+ if ((err = parcel->readInt32Vector(&sensorPixelModesUsed)) != OK) {
+ ALOGE("%s: Failed to read sensor pixel mode(s) from parcel", __FUNCTION__);
+ return err;
+ }
mRotation = rotation;
mSurfaceSetID = setID;
mSurfaceType = surfaceType;
@@ -152,6 +172,7 @@ status_t OutputConfiguration::readFromParcel(const android::Parcel* parcel) {
mHeight = height;
mIsDeferred = isDeferred != 0;
mIsShared = isShared != 0;
+ mIsMultiResolution = isMultiResolution != 0;
for (auto& surface : surfaceShims) {
ALOGV("%s: OutputConfiguration: %p, name %s", __FUNCTION__,
surface.graphicBufferProducer.get(),
@@ -159,9 +180,11 @@ status_t OutputConfiguration::readFromParcel(const android::Parcel* parcel) {
mGbps.push_back(surface.graphicBufferProducer);
}
+ mSensorPixelModesUsed = std::move(sensorPixelModesUsed);
+
ALOGV("%s: OutputConfiguration: rotation = %d, setId = %d, surfaceType = %d,"
- " physicalCameraId = %s", __FUNCTION__, mRotation, mSurfaceSetID,
- mSurfaceType, String8(mPhysicalCameraId).string());
+ " physicalCameraId = %s, isMultiResolution = %d", __FUNCTION__, mRotation,
+ mSurfaceSetID, mSurfaceType, String8(mPhysicalCameraId).string(), mIsMultiResolution);
return err;
}
@@ -175,6 +198,7 @@ OutputConfiguration::OutputConfiguration(sp& gbp, int ro
mIsDeferred = false;
mIsShared = isShared;
mPhysicalCameraId = physicalId;
+ mIsMultiResolution = false;
}
OutputConfiguration::OutputConfiguration(
@@ -183,7 +207,7 @@ OutputConfiguration::OutputConfiguration(
int width, int height, bool isShared)
: mGbps(gbps), mRotation(rotation), mSurfaceSetID(surfaceSetID), mSurfaceType(surfaceType),
mWidth(width), mHeight(height), mIsDeferred(false), mIsShared(isShared),
- mPhysicalCameraId(physicalCameraId) { }
+ mPhysicalCameraId(physicalCameraId), mIsMultiResolution(false) { }
status_t OutputConfiguration::writeToParcel(android::Parcel* parcel) const {
@@ -224,24 +248,54 @@ status_t OutputConfiguration::writeToParcel(android::Parcel* parcel) const {
err = parcel->writeString16(mPhysicalCameraId);
if (err != OK) return err;
+ err = parcel->writeInt32(mIsMultiResolution ? 1 : 0);
+ if (err != OK) return err;
+
+ err = parcel->writeParcelableVector(mSensorPixelModesUsed);
+ if (err != OK) return err;
+
return OK;
}
+template
+static bool simpleVectorsEqual(T first, T second) {
+ if (first.size() != second.size()) {
+ return false;
+ }
+
+ for (size_t i = 0; i < first.size(); i++) {
+ if (first[i] != second[i]) {
+ return false;
+ }
+ }
+ return true;
+}
+
bool OutputConfiguration::gbpsEqual(const OutputConfiguration& other) const {
const std::vector >& otherGbps =
other.getGraphicBufferProducers();
+ return simpleVectorsEqual(otherGbps, mGbps);
+}
- if (mGbps.size() != otherGbps.size()) {
- return false;
+bool OutputConfiguration::sensorPixelModesUsedEqual(const OutputConfiguration& other) const {
+ const std::vector& othersensorPixelModesUsed = other.getSensorPixelModesUsed();
+ return simpleVectorsEqual(othersensorPixelModesUsed, mSensorPixelModesUsed);
+}
+
+bool OutputConfiguration::sensorPixelModesUsedLessThan(const OutputConfiguration& other) const {
+ const std::vector& spms = other.getSensorPixelModesUsed();
+
+ if (mSensorPixelModesUsed.size() != spms.size()) {
+ return mSensorPixelModesUsed.size() < spms.size();
}
- for (size_t i = 0; i < mGbps.size(); i++) {
- if (mGbps[i] != otherGbps[i]) {
- return false;
+ for (size_t i = 0; i < spms.size(); i++) {
+ if (mSensorPixelModesUsed[i] != spms[i]) {
+ return mSensorPixelModesUsed[i] < spms[i];
}
}
- return true;
+ return false;
}
bool OutputConfiguration::gbpsLessThan(const OutputConfiguration& other) const {
diff --git a/camera/camera2/SessionConfiguration.cpp b/camera/camera2/SessionConfiguration.cpp
index a431a33525cfb22eeaa38eb0c26156ddb4cc5044..7cf6087830b3fbcc8d7ed555e730708de399ff83 100644
--- a/camera/camera2/SessionConfiguration.cpp
+++ b/camera/camera2/SessionConfiguration.cpp
@@ -55,6 +55,12 @@ status_t SessionConfiguration::readFromParcel(const android::Parcel* parcel) {
return err;
}
+ bool inputIsMultiResolution = false;
+ if ((err = parcel->readBool(&inputIsMultiResolution)) != OK) {
+ ALOGE("%s: Failed to read input multi-resolution flag from parcel", __FUNCTION__);
+ return err;
+ }
+
std::vector outputStreams;
if ((err = parcel->readParcelableVector(&outputStreams)) != OK) {
ALOGE("%s: Failed to read output configurations from parcel", __FUNCTION__);
@@ -65,6 +71,7 @@ status_t SessionConfiguration::readFromParcel(const android::Parcel* parcel) {
mInputWidth = inputWidth;
mInputHeight = inputHeight;
mInputFormat = inputFormat;
+ mInputIsMultiResolution = inputIsMultiResolution;
for (auto& stream : outputStreams) {
mOutputStreams.push_back(stream);
}
@@ -90,6 +97,9 @@ status_t SessionConfiguration::writeToParcel(android::Parcel* parcel) const {
err = parcel->writeInt32(mInputFormat);
if (err != OK) return err;
+ err = parcel->writeBool(mInputIsMultiResolution);
+ if (err != OK) return err;
+
err = parcel->writeParcelableVector(mOutputStreams);
if (err != OK) return err;
diff --git a/camera/cameraserver/Android.bp b/camera/cameraserver/Android.bp
index f58f20c0963a90e71f7f7a7a96f4353dd522f58c..8ca892001251fcd5ac52ea36df3f0fd3549e16a5 100644
--- a/camera/cameraserver/Android.bp
+++ b/camera/cameraserver/Android.bp
@@ -42,11 +42,12 @@ cc_binary {
"android.hardware.camera.provider@2.4",
"android.hardware.camera.provider@2.5",
"android.hardware.camera.provider@2.6",
+ "android.hardware.camera.provider@2.7",
"android.hardware.camera.device@1.0",
"android.hardware.camera.device@3.2",
"android.hardware.camera.device@3.4",
],
- compile_multilib: "prefer32",
+ compile_multilib: "first",
cflags: [
"-Wall",
"-Wextra",
@@ -57,6 +58,6 @@ cc_binary {
init_rc: ["cameraserver.rc"],
vintf_fragments: [
- "manifest_android.frameworks.cameraservice.service@2.1.xml",
+ "manifest_android.frameworks.cameraservice.service@2.2.xml",
],
}
diff --git a/camera/cameraserver/manifest_android.frameworks.cameraservice.service@2.1.xml b/camera/cameraserver/manifest_android.frameworks.cameraservice.service@2.2.xml
similarity index 90%
rename from camera/cameraserver/manifest_android.frameworks.cameraservice.service@2.1.xml
rename to camera/cameraserver/manifest_android.frameworks.cameraservice.service@2.2.xml
index 5a15b35b322ab53ffb4eb7f3ad355d24b078d695..eeafc91cbc6f4c1f3ce648e7a759f840f31c1e55 100644
--- a/camera/cameraserver/manifest_android.frameworks.cameraservice.service@2.1.xml
+++ b/camera/cameraserver/manifest_android.frameworks.cameraservice.service@2.2.xml
@@ -2,7 +2,7 @@
android.frameworks.cameraservice.service
hwbinder
- 2.1
+ 2.2
ICameraService
default
diff --git a/camera/include/camera/Camera.h b/camera/include/camera/Camera.h
index 2cdb617e8193a20bbfbb86646a651862087043f1..58ccd699d2097fe484c088db3bee86684bc0acff 100644
--- a/camera/include/camera/Camera.h
+++ b/camera/include/camera/Camera.h
@@ -24,7 +24,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -59,7 +58,7 @@ struct CameraTraits
typedef ::android::hardware::ICameraClient TCamCallbacks;
typedef ::android::binder::Status(::android::hardware::ICameraService::*TCamConnectService)
(const sp<::android::hardware::ICameraClient>&,
- int, const String16&, int, int,
+ int, const String16&, int, int, int,
/*out*/
sp<::android::hardware::ICamera>*);
static TCamConnectService fnConnectService;
@@ -82,11 +81,7 @@ public:
static sp create(const sp<::android::hardware::ICamera>& camera);
static sp connect(int cameraId,
const String16& clientPackageName,
- int clientUid, int clientPid);
-
- static status_t connectLegacy(int cameraId, int halVersion,
- const String16& clientPackageName,
- int clientUid, sp& camera);
+ int clientUid, int clientPid, int targetSdkVersion);
virtual ~Camera();
@@ -154,7 +149,6 @@ public:
status_t setVideoTarget(const sp& bufferProducer);
void setListener(const sp& listener);
- void setRecordingProxyListener(const sp& listener);
// Configure preview callbacks to app. Only one of the older
// callbacks or the callback surface can be active at the same time;
@@ -187,12 +181,8 @@ public:
explicit RecordingProxy(const sp& camera);
// ICameraRecordingProxy interface
- virtual status_t startRecording(const sp& listener);
+ virtual status_t startRecording();
virtual void stopRecording();
- virtual void releaseRecordingFrame(const sp& mem);
- virtual void releaseRecordingFrameHandle(native_handle_t* handle);
- virtual void releaseRecordingFrameHandleBatch(
- const std::vector& handles);
private:
sp mCamera;
@@ -203,8 +193,6 @@ protected:
Camera(const Camera&);
Camera& operator=(const Camera);
- sp mRecordingProxyListener;
-
friend class CameraBase;
};
diff --git a/camera/include/camera/CameraBase.h b/camera/include/camera/CameraBase.h
index 499b0e6b0959797ef9b7854214bc1a21b0aca518..e156994798e10df296c37f5a5594f4f0030192f1 100644
--- a/camera/include/camera/CameraBase.h
+++ b/camera/include/camera/CameraBase.h
@@ -113,7 +113,7 @@ public:
static sp connect(int cameraId,
const String16& clientPackageName,
- int clientUid, int clientPid);
+ int clientUid, int clientPid, int targetSdkVersion);
virtual void disconnect();
void setListener(const sp& listener);
diff --git a/camera/include/camera/CameraMetadata.h b/camera/include/camera/CameraMetadata.h
index e883ffa651f8fd3ef9210d4856f7f6e07e6e87ae..c56ee6da8ba53a97af918d3bdad734d79bcc8db1 100644
--- a/camera/include/camera/CameraMetadata.h
+++ b/camera/include/camera/CameraMetadata.h
@@ -242,6 +242,11 @@ class CameraMetadata: public Parcelable {
static status_t getTagFromName(const char *name,
const VendorTagDescriptor* vTags, uint32_t *tag);
+ /**
+ * Return the current vendor tag id associated with this metadata.
+ */
+ metadata_vendor_id_t getVendorId();
+
private:
camera_metadata_t *mBuffer;
mutable bool mLocked;
diff --git a/camera/include/camera/CameraSessionStats.h b/camera/include/camera/CameraSessionStats.h
new file mode 100644
index 0000000000000000000000000000000000000000..c398acaa02e4b65122b4537f1b7dba385293c58a
--- /dev/null
+++ b/camera/include/camera/CameraSessionStats.h
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_CAMERA_SERVICE_SESSION_STATS_H
+#define ANDROID_HARDWARE_CAMERA_SERVICE_SESSION_STATS_H
+
+#include
+
+namespace android {
+namespace hardware {
+
+/**
+ * Camera stream info and statistics
+ */
+class CameraStreamStats : public android::Parcelable {
+public:
+ enum HistogramType {
+ HISTOGRAM_TYPE_UNKNOWN = 0,
+ HISTOGRAM_TYPE_CAPTURE_LATENCY = 1,
+ };
+
+ int mWidth;
+ int mHeight;
+ int mFormat;
+ int mDataSpace;
+ int64_t mUsage;
+
+ // The number of requested buffers
+ int64_t mRequestCount;
+ // The number of buffer errors
+ int64_t mErrorCount;
+
+ // The capture latency of 1st request for this stream
+ int32_t mStartLatencyMs;
+
+ // Buffer count info
+ int mMaxHalBuffers;
+ int mMaxAppBuffers;
+
+ // Histogram type. So far only capture latency histogram is supported.
+ int mHistogramType;
+ // The bounary values separating adjacent histogram bins.
+ // A vector of {h1, h2, h3} represents bins of [0, h1), [h1, h2), [h2, h3),
+ // and [h3, infinity)
+ std::vector mHistogramBins;
+ // The counts for all histogram bins.
+ // size(mHistogramBins) + 1 = size(mHistogramCounts)
+ std::vector mHistogramCounts;
+
+ CameraStreamStats() :
+ mWidth(0), mHeight(0), mFormat(0), mDataSpace(0), mUsage(0),
+ mRequestCount(0), mErrorCount(0), mStartLatencyMs(0),
+ mMaxHalBuffers(0), mMaxAppBuffers(0), mHistogramType(HISTOGRAM_TYPE_UNKNOWN) {}
+ CameraStreamStats(int width, int height, int format, int dataSpace, int64_t usage,
+ int maxHalBuffers, int maxAppBuffers)
+ : mWidth(width), mHeight(height), mFormat(format), mDataSpace(dataSpace),
+ mUsage(usage), mRequestCount(0), mErrorCount(0), mStartLatencyMs(0),
+ mMaxHalBuffers(maxHalBuffers), mMaxAppBuffers(maxAppBuffers),
+ mHistogramType(HISTOGRAM_TYPE_UNKNOWN) {}
+
+ virtual status_t readFromParcel(const android::Parcel* parcel) override;
+ virtual status_t writeToParcel(android::Parcel* parcel) const override;
+};
+
+/**
+ * Camera session statistics
+ *
+ * This includes session wide info and stream statistics.
+ */
+class CameraSessionStats : public android::Parcelable {
+public:
+ /**
+ * Values for notifyCameraState newCameraState
+ */
+ static const int CAMERA_STATE_OPEN;
+ static const int CAMERA_STATE_ACTIVE;
+ static const int CAMERA_STATE_IDLE;
+ static const int CAMERA_STATE_CLOSED;
+
+ /**
+ * Values for notifyCameraState facing
+ */
+ static const int CAMERA_FACING_BACK;
+ static const int CAMERA_FACING_FRONT;
+ static const int CAMERA_FACING_EXTERNAL;
+
+ /**
+ * Values for notifyCameraState api level
+ */
+ static const int CAMERA_API_LEVEL_1;
+ static const int CAMERA_API_LEVEL_2;
+
+ String16 mCameraId;
+ int mFacing;
+ int mNewCameraState;
+ String16 mClientName;
+ int mApiLevel;
+ bool mIsNdk;
+ // latency in ms for camera open, close, or session creation.
+ int mLatencyMs;
+
+ // Session info and statistics
+ int mSessionType;
+ int mInternalReconfigure;
+ // The number of capture requests
+ int64_t mRequestCount;
+ // The number of result error
+ int64_t mResultErrorCount;
+ // Whether the device runs into an error state
+ bool mDeviceError;
+ std::vector mStreamStats;
+
+ // Constructors
+ CameraSessionStats();
+ CameraSessionStats(const String16& cameraId, int facing, int newCameraState,
+ const String16& clientName, int apiLevel, bool isNdk, int32_t latencyMs);
+
+ virtual status_t readFromParcel(const android::Parcel* parcel) override;
+ virtual status_t writeToParcel(android::Parcel* parcel) const override;
+};
+
+}; // namespace hardware
+}; // namespace android
+
+#endif // ANDROID_HARDWARE_CAMERA_SERVICE_SESSION_STATS_H
diff --git a/camera/include/camera/ICameraRecordingProxy.h b/camera/include/camera/ICameraRecordingProxy.h
index 02af2f360406cc5dc0e2dcc24a38132c5a3ca02f..4306dc182ca1d42d8774455de046b6a9af525b5d 100644
--- a/camera/include/camera/ICameraRecordingProxy.h
+++ b/camera/include/camera/ICameraRecordingProxy.h
@@ -24,13 +24,11 @@
namespace android {
-class ICameraRecordingProxyListener;
-class IMemory;
class Parcel;
/*
- * The purpose of ICameraRecordingProxy and ICameraRecordingProxyListener is to
- * allow applications using the camera during recording.
+ * The purpose of ICameraRecordingProxy is to
+ * allow applications to use the camera during recording with the old camera API.
*
* Camera service allows only one client at a time. Since camcorder application
* needs to own the camera to do things like zoom, the media recorder cannot
@@ -42,35 +40,29 @@ class Parcel;
* ICameraRecordingProxy
* startRecording()
* stopRecording()
- * releaseRecordingFrame()
*
- * ICameraRecordingProxyListener
- * dataCallbackTimestamp()
-
* The camcorder app opens the camera and starts the preview. The app passes
* ICamera and ICameraRecordingProxy to the media recorder by
* MediaRecorder::setCamera(). The recorder uses ICamera to setup the camera in
* MediaRecorder::start(). After setup, the recorder disconnects from camera
- * service. The recorder calls ICameraRecordingProxy::startRecording() and
- * passes a ICameraRecordingProxyListener to the app. The app connects back to
- * camera service and starts the recording. The app owns the camera and can do
- * things like zoom. The media recorder receives the video frames from the
- * listener and releases them by ICameraRecordingProxy::releaseRecordingFrame.
- * The recorder calls ICameraRecordingProxy::stopRecording() to stop the
- * recording.
+ * service. The recorder calls ICameraRecordingProxy::startRecording() and The
+ * app owns the camera and can do things like zoom. The media recorder receives
+ * the video frames via a buffer queue. The recorder calls
+ * ICameraRecordingProxy::stopRecording() to stop the recording.
*
* The call sequences are as follows:
* 1. The app: Camera.unlock().
* 2. The app: MediaRecorder.setCamera().
* 3. Start recording
* (1) The app: MediaRecorder.start().
- * (2) The recorder: ICamera.unlock() and ICamera.disconnect().
- * (3) The recorder: ICameraRecordingProxy.startRecording().
- * (4) The app: ICamera.reconnect().
- * (5) The app: ICamera.startRecording().
+ * (2) The recorder: ICamera.setVideoTarget(buffer queue).
+ * (3) The recorder: ICamera.unlock() and ICamera.disconnect().
+ * (4) The recorder: ICameraRecordingProxy.startRecording().
+ * (5) The app: ICamera.reconnect().
+ * (6) The app: ICamera.startRecording().
* 4. During recording
- * (1) The recorder: receive frames from ICameraRecordingProxyListener.dataCallbackTimestamp()
- * (2) The recorder: release frames by ICameraRecordingProxy.releaseRecordingFrame().
+ * (1) The recorder: receive frames via a buffer queue
+ * (2) The recorder: release frames via a buffer queue
* 5. Stop recording
* (1) The app: MediaRecorder.stop()
* (2) The recorder: ICameraRecordingProxy.stopRecording().
@@ -82,12 +74,8 @@ class ICameraRecordingProxy: public IInterface
public:
DECLARE_META_INTERFACE(CameraRecordingProxy);
- virtual status_t startRecording(const sp& listener) = 0;
+ virtual status_t startRecording() = 0;
virtual void stopRecording() = 0;
- virtual void releaseRecordingFrame(const sp& mem) = 0;
- virtual void releaseRecordingFrameHandle(native_handle_t *handle) = 0;
- virtual void releaseRecordingFrameHandleBatch(
- const std::vector& handles) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/camera/include/camera/ICameraRecordingProxyListener.h b/camera/include/camera/ICameraRecordingProxyListener.h
deleted file mode 100644
index da03c56b6f512661c53aa72ca6343b6999f418f2..0000000000000000000000000000000000000000
--- a/camera/include/camera/ICameraRecordingProxyListener.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_ICAMERA_RECORDING_PROXY_LISTENER_H
-#define ANDROID_HARDWARE_ICAMERA_RECORDING_PROXY_LISTENER_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace android {
-
-class Parcel;
-class IMemory;
-
-class ICameraRecordingProxyListener: public IInterface
-{
-public:
- DECLARE_META_INTERFACE(CameraRecordingProxyListener);
-
- virtual void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType,
- const sp& data) = 0;
-
- virtual void recordingFrameHandleCallbackTimestamp(nsecs_t timestamp,
- native_handle_t* handle) = 0;
-
- virtual void recordingFrameHandleCallbackTimestampBatch(
- const std::vector& timestamps,
- const std::vector& handles) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnCameraRecordingProxyListener: public BnInterface
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-}; // namespace android
-
-#endif
diff --git a/camera/include/camera/VendorTagDescriptor.h b/camera/include/camera/VendorTagDescriptor.h
index b2fbf3a923f9234cae47a5dbb5a456ac02c42290..b3440d57895392f2d2c240e67df91ad61f0a7030 100644
--- a/camera/include/camera/VendorTagDescriptor.h
+++ b/camera/include/camera/VendorTagDescriptor.h
@@ -249,6 +249,12 @@ class VendorTagDescriptorCache :
*/
static void clearGlobalVendorTagCache();
+ /**
+ * Return true if given vendor id is present in the vendor tag caches, return
+ * false otherwise.
+ */
+ static bool isVendorCachePresent(metadata_vendor_id_t vendorId);
+
};
} /* namespace android */
diff --git a/camera/include/camera/camera2/OutputConfiguration.h b/camera/include/camera/camera2/OutputConfiguration.h
index 95c4f39d91869dd658344dcac45644f9bd28bef5..f80ed3a8e6787fc1b571db003bd49e025439681b 100644
--- a/camera/include/camera/camera2/OutputConfiguration.h
+++ b/camera/include/camera/camera2/OutputConfiguration.h
@@ -47,6 +47,10 @@ public:
bool isDeferred() const;
bool isShared() const;
String16 getPhysicalCameraId() const;
+ bool isMultiResolution() const;
+
+ // set of sensor pixel mode resolutions allowed {MAX_RESOLUTION, DEFAULT_MODE};
+ const std::vector& getSensorPixelModesUsed() const;
/**
* Keep impl up-to-date with OutputConfiguration.java in frameworks/base
*/
@@ -83,7 +87,9 @@ public:
mIsDeferred == other.mIsDeferred &&
mIsShared == other.mIsShared &&
gbpsEqual(other) &&
- mPhysicalCameraId == other.mPhysicalCameraId );
+ mPhysicalCameraId == other.mPhysicalCameraId &&
+ mIsMultiResolution == other.mIsMultiResolution &&
+ sensorPixelModesUsedEqual(other));
}
bool operator != (const OutputConfiguration& other) const {
return !(*this == other);
@@ -114,13 +120,22 @@ public:
if (mPhysicalCameraId != other.mPhysicalCameraId) {
return mPhysicalCameraId < other.mPhysicalCameraId;
}
+ if (mIsMultiResolution != other.mIsMultiResolution) {
+ return mIsMultiResolution < other.mIsMultiResolution;
+ }
+ if (!sensorPixelModesUsedEqual(other)) {
+ return sensorPixelModesUsedLessThan(other);
+ }
return gbpsLessThan(other);
}
+
bool operator > (const OutputConfiguration& other) const {
return (*this != other && !(*this < other));
}
bool gbpsEqual(const OutputConfiguration& other) const;
+ bool sensorPixelModesUsedEqual(const OutputConfiguration& other) const;
+ bool sensorPixelModesUsedLessThan(const OutputConfiguration& other) const;
bool gbpsLessThan(const OutputConfiguration& other) const;
void addGraphicProducer(sp gbp) {mGbps.push_back(gbp);}
private:
@@ -133,6 +148,8 @@ private:
bool mIsDeferred;
bool mIsShared;
String16 mPhysicalCameraId;
+ bool mIsMultiResolution;
+ std::vector mSensorPixelModesUsed;
};
} // namespace params
} // namespace camera2
diff --git a/camera/include/camera/camera2/SessionConfiguration.h b/camera/include/camera/camera2/SessionConfiguration.h
index 64288ed1bba627e27d6bead3c8a3f20173afacfc..29913f6f0b89a4a85a622cab0ff670b6ae0cb78e 100644
--- a/camera/include/camera/camera2/SessionConfiguration.h
+++ b/camera/include/camera/camera2/SessionConfiguration.h
@@ -38,6 +38,7 @@ public:
int getInputHeight() const { return mInputHeight; }
int getInputFormat() const { return mInputFormat; }
int getOperatingMode() const { return mOperatingMode; }
+ bool inputIsMultiResolution() const { return mInputIsMultiResolution; }
virtual status_t writeToParcel(android::Parcel* parcel) const override;
virtual status_t readFromParcel(const android::Parcel* parcel) override;
@@ -61,7 +62,8 @@ public:
mInputWidth == other.mInputWidth &&
mInputHeight == other.mInputHeight &&
mInputFormat == other.mInputFormat &&
- mOperatingMode == other.mOperatingMode);
+ mOperatingMode == other.mOperatingMode &&
+ mInputIsMultiResolution == other.mInputIsMultiResolution);
}
bool operator != (const SessionConfiguration& other) const {
@@ -83,6 +85,10 @@ public:
return mInputFormat < other.mInputFormat;
}
+ if (mInputIsMultiResolution != other.mInputIsMultiResolution) {
+ return mInputIsMultiResolution < other.mInputIsMultiResolution;
+ }
+
if (mOperatingMode != other.mOperatingMode) {
return mOperatingMode < other.mOperatingMode;
}
@@ -104,6 +110,7 @@ private:
std::vector mOutputStreams;
int mInputWidth, mInputHeight, mInputFormat, mOperatingMode;
+ bool mInputIsMultiResolution = false;
};
} // namespace params
} // namespace camera2
diff --git a/camera/ndk/Android.bp b/camera/ndk/Android.bp
index 24eaba65e7e14da80b762db5838df4cd245a07be..fef873b4c4467805f00e53893030981e59e90e25 100644
--- a/camera/ndk/Android.bp
+++ b/camera/ndk/Android.bp
@@ -93,7 +93,7 @@ cc_library_shared {
],
cflags: [
"-fvisibility=hidden",
- "-DEXPORT=__attribute__ ((visibility (\"default\")))",
+ "-DEXPORT=__attribute__((visibility(\"default\")))",
"-Wall",
"-Wextra",
"-Werror",
@@ -152,9 +152,11 @@ cc_library_shared {
"libcamera_metadata",
"libmediandk",
"android.frameworks.cameraservice.device@2.0",
+ "android.frameworks.cameraservice.device@2.1",
"android.frameworks.cameraservice.common@2.0",
"android.frameworks.cameraservice.service@2.0",
"android.frameworks.cameraservice.service@2.1",
+ "android.frameworks.cameraservice.service@2.2",
],
static_libs: [
"android.hardware.camera.common@1.0-helper",
diff --git a/camera/ndk/impl/ACameraDevice.cpp b/camera/ndk/impl/ACameraDevice.cpp
index 78974ae7fc337bc114cdc884c59234629b2b824f..dd652c70c52ea4661690abafdc8af6337bd8834d 100644
--- a/camera/ndk/impl/ACameraDevice.cpp
+++ b/camera/ndk/impl/ACameraDevice.cpp
@@ -186,6 +186,7 @@ CameraDevice::createCaptureSession(
const ACaptureRequest* sessionParameters,
const ACameraCaptureSession_stateCallbacks* callbacks,
/*out*/ACameraCaptureSession** session) {
+ nsecs_t startTimeNs = systemTime();
sp currentSession = mCurrentSession.promote();
Mutex::Autolock _l(mDeviceLock);
camera_status_t ret = checkCameraClosedOrErrorLocked();
@@ -199,7 +200,7 @@ CameraDevice::createCaptureSession(
}
// Create new session
- ret = configureStreamsLocked(outputs, sessionParameters);
+ ret = configureStreamsLocked(outputs, sessionParameters, startTimeNs);
if (ret != ACAMERA_OK) {
ALOGE("Fail to create new session. cannot configure streams");
return ret;
@@ -450,7 +451,11 @@ CameraDevice::notifySessionEndOfLifeLocked(ACameraCaptureSession* session) {
}
// No new session, unconfigure now
- camera_status_t ret = configureStreamsLocked(nullptr, nullptr);
+ // Note: The unconfiguration of session won't be accounted for session
+ // latency because a stream configuration with 0 streams won't ever become
+ // active.
+ nsecs_t startTimeNs = systemTime();
+ camera_status_t ret = configureStreamsLocked(nullptr, nullptr, startTimeNs);
if (ret != ACAMERA_OK) {
ALOGE("Unconfigure stream failed. Device might still be configured! ret %d", ret);
}
@@ -609,7 +614,7 @@ CameraDevice::getSurfaceFromANativeWindow(
camera_status_t
CameraDevice::configureStreamsLocked(const ACaptureSessionOutputContainer* outputs,
- const ACaptureRequest* sessionParameters) {
+ const ACaptureRequest* sessionParameters, nsecs_t startTimeNs) {
ACaptureSessionOutputContainer emptyOutput;
if (outputs == nullptr) {
outputs = &emptyOutput;
@@ -711,7 +716,8 @@ CameraDevice::configureStreamsLocked(const ACaptureSessionOutputContainer* outpu
params.append(sessionParameters->settings->getInternalData());
}
std::vector offlineStreamIds;
- remoteRet = mRemote->endConfigure(/*isConstrainedHighSpeed*/ false, params, &offlineStreamIds);
+ remoteRet = mRemote->endConfigure(/*isConstrainedHighSpeed*/ false, params,
+ ns2ms(startTimeNs), &offlineStreamIds);
if (remoteRet.serviceSpecificErrorCode() == hardware::ICameraService::ERROR_ILLEGAL_ARGUMENT) {
ALOGE("Camera device %s cannnot support app output configuration: %s", getId(),
remoteRet.toString8().string());
diff --git a/camera/ndk/impl/ACameraDevice.h b/camera/ndk/impl/ACameraDevice.h
index 3073dfb023bae0571c5635b9bcbe0add5e51ea93..344d9644183349dbeb2b5357f26e8d86aae0d47f 100644
--- a/camera/ndk/impl/ACameraDevice.h
+++ b/camera/ndk/impl/ACameraDevice.h
@@ -167,7 +167,7 @@ class CameraDevice final : public RefBase {
void notifySessionEndOfLifeLocked(ACameraCaptureSession* session);
camera_status_t configureStreamsLocked(const ACaptureSessionOutputContainer* outputs,
- const ACaptureRequest* sessionParameters);
+ const ACaptureRequest* sessionParameters, nsecs_t startTimeNs);
// Input message will be posted and cleared after this returns
void postSessionMsgAndCleanup(sp& msg);
diff --git a/camera/ndk/impl/ACameraManager.cpp b/camera/ndk/impl/ACameraManager.cpp
index 73cabbfcc94fc78fe9b2d8ba24c53f5ce787c932..95ef2b2af1f828c9901bb42f9ff780adb87c4fee 100644
--- a/camera/ndk/impl/ACameraManager.cpp
+++ b/camera/ndk/impl/ACameraManager.cpp
@@ -689,7 +689,9 @@ camera_status_t ACameraManager::getCameraCharacteristics(
return ACAMERA_ERROR_CAMERA_DISCONNECTED;
}
CameraMetadata rawMetadata;
- binder::Status serviceRet = cs->getCameraCharacteristics(String16(cameraIdStr), &rawMetadata);
+ int targetSdkVersion = android_get_application_target_sdk_version();
+ binder::Status serviceRet = cs->getCameraCharacteristics(String16(cameraIdStr),
+ targetSdkVersion, &rawMetadata);
if (!serviceRet.isOk()) {
switch(serviceRet.serviceSpecificErrorCode()) {
case hardware::ICameraService::ERROR_DISCONNECTED:
@@ -735,11 +737,13 @@ ACameraManager::openCamera(
sp callbacks = device->getServiceCallback();
sp deviceRemote;
+ int targetSdkVersion = android_get_application_target_sdk_version();
// No way to get package name from native.
// Send a zero length package name and let camera service figure it out from UID
binder::Status serviceRet = cs->connectDevice(
callbacks, String16(cameraId), String16(""), {},
- hardware::ICameraService::USE_CALLING_UID, /*out*/&deviceRemote);
+ hardware::ICameraService::USE_CALLING_UID, /*oomScoreOffset*/0,
+ targetSdkVersion, /*out*/&deviceRemote);
if (!serviceRet.isOk()) {
ALOGE("%s: connect camera device failed: %s", __FUNCTION__, serviceRet.toString8().string());
diff --git a/camera/ndk/impl/ACameraMetadata.cpp b/camera/ndk/impl/ACameraMetadata.cpp
index bfa60d98c64a7205e6bec3e35d97fc10ef2b3a63..dab2fefc5ca5f962ecd5fd7f446095375f4f1a4a 100644
--- a/camera/ndk/impl/ACameraMetadata.cpp
+++ b/camera/ndk/impl/ACameraMetadata.cpp
@@ -24,6 +24,28 @@
using namespace android;
+// Formats not listed in the public API, but still available to AImageReader
+// Enum value must match corresponding enum in ui/PublicFormat.h (which is not
+// available to VNDK)
+enum AIMAGE_PRIVATE_FORMATS {
+ /**
+ * Unprocessed implementation-dependent raw
+ * depth measurements, opaque with 16 bit
+ * samples.
+ *
+ */
+
+ AIMAGE_FORMAT_RAW_DEPTH = 0x1002,
+
+ /**
+ * Device specific 10 bits depth RAW image format.
+ *
+ * Unprocessed implementation-dependent raw depth measurements, opaque with 10 bit samples
+ * and device specific bit layout.
+ */
+ AIMAGE_FORMAT_RAW_DEPTH10 = 0x1003,
+};
+
/**
* ACameraMetadata Implementation
*/
@@ -290,6 +312,10 @@ ACameraMetadata::filterStreamConfigurations() {
format = AIMAGE_FORMAT_DEPTH_POINT_CLOUD;
} else if (format == HAL_PIXEL_FORMAT_Y16) {
format = AIMAGE_FORMAT_DEPTH16;
+ } else if (format == HAL_PIXEL_FORMAT_RAW16) {
+ format = static_cast(AIMAGE_FORMAT_RAW_DEPTH);
+ } else if (format == HAL_PIXEL_FORMAT_RAW10) {
+ format = static_cast(AIMAGE_FORMAT_RAW_DEPTH10);
}
filteredDepthStreamConfigs.push_back(format);
@@ -426,6 +452,7 @@ ACameraMetadata::getTags(/*out*/int32_t* numTags,
camera_metadata_ro_entry_t entry;
int ret = get_camera_metadata_ro_entry(rawMetadata, i, &entry);
if (ret != 0) {
+ mData->unlock(rawMetadata);
ALOGE("%s: error reading metadata index %zu", __FUNCTION__, i);
return ACAMERA_ERROR_UNKNOWN;
}
@@ -527,11 +554,13 @@ ACameraMetadata::isCaptureRequestTag(const uint32_t tag) {
case ACAMERA_LENS_OPTICAL_STABILIZATION_MODE:
case ACAMERA_NOISE_REDUCTION_MODE:
case ACAMERA_SCALER_CROP_REGION:
+ case ACAMERA_SCALER_ROTATE_AND_CROP:
case ACAMERA_SENSOR_EXPOSURE_TIME:
case ACAMERA_SENSOR_FRAME_DURATION:
case ACAMERA_SENSOR_SENSITIVITY:
case ACAMERA_SENSOR_TEST_PATTERN_DATA:
case ACAMERA_SENSOR_TEST_PATTERN_MODE:
+ case ACAMERA_SENSOR_PIXEL_MODE:
case ACAMERA_SHADING_MODE:
case ACAMERA_STATISTICS_FACE_DETECT_MODE:
case ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE:
@@ -582,6 +611,7 @@ std::unordered_set ACameraMetadata::sSystemTags ({
ANDROID_SENSOR_PROFILE_HUE_SAT_MAP,
ANDROID_SENSOR_PROFILE_TONE_CURVE,
ANDROID_SENSOR_OPAQUE_RAW_SIZE,
+ ANDROID_SENSOR_OPAQUE_RAW_SIZE_MAXIMUM_RESOLUTION,
ANDROID_SHADING_STRENGTH,
ANDROID_STATISTICS_HISTOGRAM_MODE,
ANDROID_STATISTICS_SHARPNESS_MAP_MODE,
diff --git a/camera/ndk/include/camera/NdkCameraCaptureSession.h b/camera/ndk/include/camera/NdkCameraCaptureSession.h
index 6c1cf3395aabb7358545fe891443f122869f5e57..2b7f040be449c3884795ed41b1aa6dc6d027c0ee 100644
--- a/camera/ndk/include/camera/NdkCameraCaptureSession.h
+++ b/camera/ndk/include/camera/NdkCameraCaptureSession.h
@@ -61,6 +61,10 @@ typedef struct ACameraCaptureSession ACameraCaptureSession;
*/
typedef void (*ACameraCaptureSession_stateCallback)(void* context, ACameraCaptureSession *session);
+/**
+ * Capture session state callbacks used in {@link ACameraDevice_createCaptureSession} and
+ * {@link ACameraDevice_createCaptureSessionWithSessionParameters}
+ */
typedef struct ACameraCaptureSession_stateCallbacks {
/// optional application context.
void* context;
@@ -246,6 +250,10 @@ typedef void (*ACameraCaptureSession_captureCallback_bufferLost)(
void* context, ACameraCaptureSession* session,
ACaptureRequest* request, ACameraWindowType* window, int64_t frameNumber);
+/**
+ * ACaptureCaptureSession_captureCallbacks structure used in
+ * {@link ACameraCaptureSession_capture} and {@link ACameraCaptureSession_setRepeatingRequest}.
+ */
typedef struct ACameraCaptureSession_captureCallbacks {
/// optional application context.
void* context;
@@ -413,7 +421,10 @@ enum {
*/
void ACameraCaptureSession_close(ACameraCaptureSession* session);
-struct ACameraDevice;
+/**
+ * ACameraDevice is opaque type that provides access to a camera device.
+ * A pointer can be obtained using {@link ACameraManager_openCamera} method.
+ */
typedef struct ACameraDevice ACameraDevice;
/**
@@ -591,6 +602,10 @@ camera_status_t ACameraCaptureSession_stopRepeating(ACameraCaptureSession* sessi
camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* session)
__INTRODUCED_IN(24);
+/**
+ * Opaque object for capture session output, use {@link ACaptureSessionOutput_create} or
+ * {@link ACaptureSessionSharedOutput_create} to create an instance.
+ */
typedef struct ACaptureSessionOutput ACaptureSessionOutput;
/**
@@ -604,9 +619,9 @@ typedef struct ACaptureSessionOutput ACaptureSessionOutput;
*
* Native windows that get removed must not be part of any active repeating or single/burst
* request or have any pending results. Consider updating repeating requests via
- * {@link ACaptureSessionOutput_setRepeatingRequest} and then wait for the last frame number
+ * {@link ACameraCaptureSession_setRepeatingRequest} and then wait for the last frame number
* when the sequence completes
- * {@link ACameraCaptureSession_captureCallback#onCaptureSequenceCompleted}.
+ * {@link ACameraCaptureSession_captureCallbacks#onCaptureSequenceCompleted}.
*
* Native windows that get added must not be part of any other registered ACaptureSessionOutput
* and must be compatible. Compatible windows must have matching format, rotation and
@@ -713,7 +728,15 @@ typedef struct ACameraCaptureSession_logicalCamera_captureCallbacks {
* Same as ACameraCaptureSession_captureCallbacks
*/
void* context;
+
+ /**
+ * Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureStarted}.
+ */
ACameraCaptureSession_captureCallback_start onCaptureStarted;
+
+ /**
+ * Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureProgressed}.
+ */
ACameraCaptureSession_captureCallback_result onCaptureProgressed;
/**
@@ -751,10 +774,18 @@ typedef struct ACameraCaptureSession_logicalCamera_captureCallbacks {
ACameraCaptureSession_logicalCamera_captureCallback_failed onLogicalCameraCaptureFailed;
/**
- * Same as ACameraCaptureSession_captureCallbacks
+ * Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureSequenceCompleted}.
*/
ACameraCaptureSession_captureCallback_sequenceEnd onCaptureSequenceCompleted;
+
+ /**
+ * Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureSequenceAborted}.
+ */
ACameraCaptureSession_captureCallback_sequenceAbort onCaptureSequenceAborted;
+
+ /**
+ * Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureBufferLost}.
+ */
ACameraCaptureSession_captureCallback_bufferLost onCaptureBufferLost;
} ACameraCaptureSession_logicalCamera_captureCallbacks;
diff --git a/camera/ndk/include/camera/NdkCameraDevice.h b/camera/ndk/include/camera/NdkCameraDevice.h
index f72fe8d8181a5036e28969551ab8c272dbb3791c..7be4bd391c0c4545e9f5e474f7b4de01afad99ee 100644
--- a/camera/ndk/include/camera/NdkCameraDevice.h
+++ b/camera/ndk/include/camera/NdkCameraDevice.h
@@ -124,6 +124,10 @@ typedef void (*ACameraDevice_StateCallback)(void* context, ACameraDevice* device
*/
typedef void (*ACameraDevice_ErrorStateCallback)(void* context, ACameraDevice* device, int error);
+/**
+ * Applications' callbacks for camera device state changes, register with
+ * {@link ACameraManager_openCamera}.
+ */
typedef struct ACameraDevice_StateCallbacks {
/// optional application context.
void* context;
@@ -198,6 +202,10 @@ camera_status_t ACameraDevice_close(ACameraDevice* device) __INTRODUCED_IN(24);
*/
const char* ACameraDevice_getId(const ACameraDevice* device) __INTRODUCED_IN(24);
+/**
+ * Capture request pre-defined template types, used in {@link ACameraDevice_createCaptureRequest}
+ * and {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
+ */
typedef enum {
/**
* Create a request suitable for a camera preview window. Specifically, this
@@ -301,10 +309,12 @@ camera_status_t ACameraDevice_createCaptureRequest(
const ACameraDevice* device, ACameraDevice_request_template templateId,
/*out*/ACaptureRequest** request) __INTRODUCED_IN(24);
-
+/**
+ * Opaque object for CaptureSessionOutput container, use
+ * {@link ACaptureSessionOutputContainer_create} to create an instance.
+ */
typedef struct ACaptureSessionOutputContainer ACaptureSessionOutputContainer;
-typedef struct ACaptureSessionOutput ACaptureSessionOutput;
/**
* Create a capture session output container.
@@ -844,7 +854,7 @@ camera_status_t ACameraDevice_createCaptureRequest_withPhysicalIds(
/*out*/ACaptureRequest** request) __INTRODUCED_IN(29);
/**
- * Check whether a particular {@ACaptureSessionOutputContainer} is supported by
+ * Check whether a particular {@link ACaptureSessionOutputContainer} is supported by
* the camera device.
*
*
This method performs a runtime check of a given {@link
@@ -875,6 +885,7 @@ camera_status_t ACameraDevice_createCaptureRequest_withPhysicalIds(
* device.
*
{@link ACAMERA_ERROR_UNSUPPORTED_OPERATION} if the query operation is not
* supported by the camera device.
+ *
*/
camera_status_t ACameraDevice_isSessionConfigurationSupported(
const ACameraDevice* device,
diff --git a/camera/ndk/include/camera/NdkCameraError.h b/camera/ndk/include/camera/NdkCameraError.h
index 9d77eb4f6b57bd9f2e82b7b8118eefac7a051643..26db7f24fb01140fc35aa162d3e53e7e55cd35cf 100644
--- a/camera/ndk/include/camera/NdkCameraError.h
+++ b/camera/ndk/include/camera/NdkCameraError.h
@@ -40,7 +40,13 @@
__BEGIN_DECLS
+/**
+ * Camera status enum types.
+ */
typedef enum {
+ /**
+ * Camera operation has succeeded.
+ */
ACAMERA_OK = 0,
ACAMERA_ERROR_BASE = -10000,
diff --git a/camera/ndk/include/camera/NdkCameraManager.h b/camera/ndk/include/camera/NdkCameraManager.h
index be32b11479afab3c8eacac5751bb0c1c32cd9e90..729182e965ac246b72fbdf7fe11005b6e4e11ffc 100644
--- a/camera/ndk/include/camera/NdkCameraManager.h
+++ b/camera/ndk/include/camera/NdkCameraManager.h
@@ -326,7 +326,7 @@ typedef void (*ACameraManager_AccessPrioritiesChangedCallback)(void* context);
* @see ACameraManager_registerExtendedAvailabilityCallback
*/
typedef struct ACameraManager_ExtendedAvailabilityListener {
- ///
+ /// Called when a camera becomes available or unavailable
ACameraManager_AvailabilityCallbacks availabilityCallbacks;
/// Called when there is camera access permission change
diff --git a/camera/ndk/include/camera/NdkCameraMetadata.h b/camera/ndk/include/camera/NdkCameraMetadata.h
index 0d5e6c406ced797469e8fbe2bd841c64f7705b13..b331d501d09a20f2ab402d3e6ae0bb14ce0e3a91 100644
--- a/camera/ndk/include/camera/NdkCameraMetadata.h
+++ b/camera/ndk/include/camera/NdkCameraMetadata.h
@@ -256,10 +256,12 @@ bool ACameraMetadata_isLogicalMultiCamera(const ACameraMetadata* staticMetadata,
/**
* Return a {@link ACameraMetadata} that references the same data as
- * {@link cameraMetadata}, which is an instance of
- * {@link android.hardware.camera2.CameraMetadata} (e.g., a
- * {@link android.hardware.camera2.CameraCharacteristics} or
- * {@link android.hardware.camera2.CaptureResult}).
+ *
+ * android.hardware.camera2.CameraMetadata from Java API. (e.g., a
+ *
+ * android.hardware.camera2.CameraCharacteristics
+ * or
+ * android.hardware.camera2.CaptureResult).
*
* The returned ACameraMetadata must be freed by the application by {@link ACameraMetadata_free}
* after application is done using it.
@@ -269,11 +271,13 @@ bool ACameraMetadata_isLogicalMultiCamera(const ACameraMetadata* staticMetadata,
* the Java metadata is garbage collected.
*
* @param env the JNI environment.
- * @param cameraMetadata the source {@link android.hardware.camera2.CameraMetadata} from which the
+ * @param cameraMetadata the source
+ android.hardware.camera2.CameraMetadata from which the
* returned {@link ACameraMetadata} is a view.
*
- * @return a valid ACameraMetadata pointer or NULL if {@link cameraMetadata} is null or not a valid
- * instance of {@link android.hardware.camera2.CameraMetadata}.
+ * @return a valid ACameraMetadata pointer or NULL if cameraMetadata is null or not a valid
+ * instance of
+ * android.hardware.camera2.CameraMetadata.
*
*/
ACameraMetadata* ACameraMetadata_fromCameraMetadata(JNIEnv* env, jobject cameraMetadata)
diff --git a/camera/ndk/include/camera/NdkCameraMetadataTags.h b/camera/ndk/include/camera/NdkCameraMetadataTags.h
index bc33d6a1144cbb80f050848d0853fc2fbb4407bc..86781e5373286cfa3b5bac289fe551e9ba8cb562 100644
--- a/camera/ndk/include/camera/NdkCameraMetadataTags.h
+++ b/camera/ndk/include/camera/NdkCameraMetadataTags.h
@@ -40,6 +40,7 @@
__BEGIN_DECLS
+
typedef enum acamera_metadata_section {
ACAMERA_COLOR_CORRECTION,
ACAMERA_CONTROL,
@@ -526,6 +527,13 @@ typedef enum acamera_metadata_tag {
* scene as they do before. See ACAMERA_CONTROL_ZOOM_RATIO for details. Whether to use
* activeArraySize or preCorrectionActiveArraySize still depends on distortion correction
* mode.
+ * For camera devices with the
+ * CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ * capability,
+ * ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION /
+ * ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION must be used as the
+ * coordinate system for requests where ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
* The data representation is int[5 * area_count]
.
* Every five elements represent a metering region of (xmin, ymin, xmax, ymax, weight)
.
* The rectangle is defined to be inclusive on xmin and ymin, but exclusive on xmax and
@@ -535,7 +543,10 @@ typedef enum acamera_metadata_tag {
* @see ACAMERA_DISTORTION_CORRECTION_MODE
* @see ACAMERA_SCALER_CROP_REGION
* @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE
+ * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
* @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
+ * @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
+ * @see ACAMERA_SENSOR_PIXEL_MODE
*/
ACAMERA_CONTROL_AE_REGIONS = // int32[5*area_count]
ACAMERA_CONTROL_START + 4,
@@ -717,6 +728,12 @@ typedef enum acamera_metadata_tag {
* scene as they do before. See ACAMERA_CONTROL_ZOOM_RATIO for details. Whether to use
* activeArraySize or preCorrectionActiveArraySize still depends on distortion correction
* mode.
+ * For camera devices with the
+ * CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ * capability, ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION /
+ * ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION must be used as the
+ * coordinate system for requests where ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
* The data representation is int[5 * area_count]
.
* Every five elements represent a metering region of (xmin, ymin, xmax, ymax, weight)
.
* The rectangle is defined to be inclusive on xmin and ymin, but exclusive on xmax and
@@ -726,7 +743,10 @@ typedef enum acamera_metadata_tag {
* @see ACAMERA_DISTORTION_CORRECTION_MODE
* @see ACAMERA_SCALER_CROP_REGION
* @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE
+ * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
* @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
+ * @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
+ * @see ACAMERA_SENSOR_PIXEL_MODE
*/
ACAMERA_CONTROL_AF_REGIONS = // int32[5*area_count]
ACAMERA_CONTROL_START + 8,
@@ -814,7 +834,7 @@ typedef enum acamera_metadata_tag {
*
*
* This control is only effective if ACAMERA_CONTROL_MODE is AUTO.
- * When set to the ON mode, the camera device's auto-white balance
+ *
When set to the AUTO mode, the camera device's auto-white balance
* routine is enabled, overriding the application's selected
* ACAMERA_COLOR_CORRECTION_TRANSFORM, ACAMERA_COLOR_CORRECTION_GAINS and
* ACAMERA_COLOR_CORRECTION_MODE. Note that when ACAMERA_CONTROL_AE_MODE
@@ -903,6 +923,12 @@ typedef enum acamera_metadata_tag {
* the scene as they do before. See ACAMERA_CONTROL_ZOOM_RATIO for details. Whether to use
* activeArraySize or preCorrectionActiveArraySize still depends on distortion correction
* mode.
+ * For camera devices with the
+ * CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ * capability, ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION /
+ * ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION must be used as the
+ * coordinate system for requests where ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
* The data representation is int[5 * area_count]
.
* Every five elements represent a metering region of (xmin, ymin, xmax, ymax, weight)
.
* The rectangle is defined to be inclusive on xmin and ymin, but exclusive on xmax and
@@ -912,7 +938,10 @@ typedef enum acamera_metadata_tag {
* @see ACAMERA_DISTORTION_CORRECTION_MODE
* @see ACAMERA_SCALER_CROP_REGION
* @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE
+ * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
* @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
+ * @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
+ * @see ACAMERA_SENSOR_PIXEL_MODE
*/
ACAMERA_CONTROL_AWB_REGIONS = // int32[5*area_count]
ACAMERA_CONTROL_START + 12,
@@ -1839,7 +1868,7 @@ typedef enum acamera_metadata_tag {
*
If the camera device has BURST_CAPTURE capability, the frame rate requirement of
* BURST_CAPTURE must still be met.
* All streams not larger than the maximum streaming dimension for BOKEH_STILL_CAPTURE mode
- * (queried via {@link ACAMERA_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_CAPABILITIES })
+ * (queried via {@link ACAMERA_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES })
* will have preview bokeh effect applied.
*
* When set to BOKEH_CONTINUOUS mode, configured streams dimension should not exceed this mode's
@@ -1959,6 +1988,16 @@ typedef enum acamera_metadata_tag {
* ACAMERA_CONTROL_ZOOM_RATIO is not 1.0, and ACAMERA_SCALER_CROP_REGION is set to be
* windowboxing, the camera framework will override the ACAMERA_SCALER_CROP_REGION to be
* the active array.
+ * In the capture request, if the application sets ACAMERA_CONTROL_ZOOM_RATIO to a
+ * value != 1.0, the ACAMERA_CONTROL_ZOOM_RATIO tag in the capture result reflects the
+ * effective zoom ratio achieved by the camera device, and the ACAMERA_SCALER_CROP_REGION
+ * adjusts for additional crops that are not zoom related. Otherwise, if the application
+ * sets ACAMERA_CONTROL_ZOOM_RATIO to 1.0, or does not set it at all, the
+ * ACAMERA_CONTROL_ZOOM_RATIO tag in the result metadata will also be 1.0.
+ * When the application requests a physical stream for a logical multi-camera, the
+ * ACAMERA_CONTROL_ZOOM_RATIO in the physical camera result metadata will be 1.0, and
+ * the ACAMERA_SCALER_CROP_REGION tag reflects the amount of zoom and crop done by the
+ * physical camera device.
*
* @see ACAMERA_CONTROL_AE_REGIONS
* @see ACAMERA_CONTROL_ZOOM_RATIO
@@ -2800,6 +2839,51 @@ typedef enum acamera_metadata_tag {
*/
ACAMERA_LENS_DISTORTION = // float[5]
ACAMERA_LENS_START + 13,
+ /**
+ * The correction coefficients to correct for this camera device's
+ * radial and tangential lens distortion for a
+ * CaptureRequest with ACAMERA_SENSOR_PIXEL_MODE set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: float[5]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_LENS_DISTORTION, when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_LENS_DISTORTION
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_LENS_DISTORTION_MAXIMUM_RESOLUTION = // float[5]
+ ACAMERA_LENS_START + 14,
+ /**
+ * The parameters for this camera device's intrinsic
+ * calibration when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: float[5]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_LENS_INTRINSIC_CALIBRATION, when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_LENS_INTRINSIC_CALIBRATION
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_LENS_INTRINSIC_CALIBRATION_MAXIMUM_RESOLUTION = // float[5]
+ ACAMERA_LENS_START + 15,
ACAMERA_LENS_END,
/**
@@ -3427,6 +3511,12 @@ typedef enum acamera_metadata_tag {
* coordinate system is post-zoom, meaning that the activeArraySize or
* preCorrectionActiveArraySize covers the camera device's field of view "after" zoom. See
* ACAMERA_CONTROL_ZOOM_RATIO for details.
+ * For camera devices with the
+ * CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ * capability, ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION /
+ * ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION must be used as the
+ * coordinate system for requests where ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
* The data representation is int[4], which maps to (left, top, width, height).
*
* @see ACAMERA_CONTROL_AE_TARGET_FPS_RANGE
@@ -3435,7 +3525,10 @@ typedef enum acamera_metadata_tag {
* @see ACAMERA_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM
* @see ACAMERA_SCALER_CROPPING_TYPE
* @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE
+ * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
* @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
+ * @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION
+ * @see ACAMERA_SENSOR_PIXEL_MODE
*/
ACAMERA_SCALER_CROP_REGION = // int32[4]
ACAMERA_SCALER_START,
@@ -3493,8 +3586,8 @@ typedef enum acamera_metadata_tag {
* Not all output formats may be supported in a configuration with
* an input stream of a particular format. For more details, see
* android.scaler.availableInputOutputFormatsMap.
- * The following table describes the minimum required output stream
- * configurations based on the hardware level
+ *
For applications targeting SDK version older than 31, the following table
+ * describes the minimum required output stream configurations based on the hardware level
* (ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL):
* Format | Size | Hardware Level | Notes
* :-------------:|:--------------------------------------------:|:--------------:|:--------------:
@@ -3506,6 +3599,28 @@ typedef enum acamera_metadata_tag {
* YUV_420_888 | all output sizes available for JPEG | FULL |
* YUV_420_888 | all output sizes available for JPEG, up to the maximum video size | LIMITED |
* IMPLEMENTATION_DEFINED | same as YUV_420_888 | Any |
+ * For applications targeting SDK version 31 or newer, if the mobile device declares to be
+ * media performance class S,
+ * the primary camera devices (first rear/front camera in the camera ID list) will not
+ * support JPEG sizes smaller than 1080p. If the application configures a JPEG stream
+ * smaller than 1080p, the camera device will round up the JPEG image size to at least
+ * 1080p. The requirements for IMPLEMENTATION_DEFINED and YUV_420_888 stay the same.
+ * This new minimum required output stream configurations are illustrated by the table below:
+ * Format | Size | Hardware Level | Notes
+ * :-------------:|:--------------------------------------------:|:--------------:|:--------------:
+ * JPEG | ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE | Any |
+ * JPEG | 1920x1080 (1080p) | Any | if 1080p <= activeArraySize
+ * YUV_420_888 | ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE | FULL |
+ * YUV_420_888 | 1920x1080 (1080p) | FULL | if 1080p <= activeArraySize
+ * YUV_420_888 | 1280x720 (720) | FULL | if 720p <= activeArraySize
+ * YUV_420_888 | 640x480 (480p) | FULL | if 480p <= activeArraySize
+ * YUV_420_888 | 320x240 (240p) | FULL | if 240p <= activeArraySize
+ * YUV_420_888 | all output sizes available for FULL hardware level, up to the maximum video size | LIMITED |
+ * IMPLEMENTATION_DEFINED | same as YUV_420_888 | Any |
+ * For applications targeting SDK version 31 or newer, if the mobile device doesn't declare
+ * to be media performance class S, or if the camera device isn't a primary rear/front
+ * camera, the minimum required output stream configurations are the same as for applications
+ * targeting SDK version older than 31.
* Refer to ACAMERA_REQUEST_AVAILABLE_CAPABILITIES for additional
* mandatory stream configurations on a per-capability basis.
* Exception on 176x144 (QCIF) resolution: camera devices usually have a fixed capability for
@@ -3537,8 +3652,6 @@ typedef enum acamera_metadata_tag {
* set to either OFF or FAST.
* When multiple streams are used in a request, the minimum frame
* duration will be max(individual stream min durations).
- * The minimum frame duration of a stream (of a particular format, size)
- * is the same regardless of whether the stream is input or output.
* See ACAMERA_SENSOR_FRAME_DURATION and
* ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS for more details about
* calculating the max frame rate.
@@ -3739,6 +3852,278 @@ typedef enum acamera_metadata_tag {
ACAMERA_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP =
// int32
ACAMERA_SCALER_START + 15,
+ /**
+ * List of rotate-and-crop modes for ACAMERA_SCALER_ROTATE_AND_CROP that are supported by this camera device.
+ *
+ * @see ACAMERA_SCALER_ROTATE_AND_CROP
+ *
+ * Type: byte[n]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * This entry lists the valid modes for ACAMERA_SCALER_ROTATE_AND_CROP for this camera device.
+ * Starting with API level 30, all devices will list at least ROTATE_AND_CROP_NONE
.
+ * Devices with support for rotate-and-crop will additionally list at least
+ * ROTATE_AND_CROP_AUTO
and ROTATE_AND_CROP_90
.
+ *
+ * @see ACAMERA_SCALER_ROTATE_AND_CROP
+ */
+ ACAMERA_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES = // byte[n]
+ ACAMERA_SCALER_START + 16,
+ /**
+ * Whether a rotation-and-crop operation is applied to processed
+ * outputs from the camera.
+ *
+ * Type: byte (acamera_metadata_enum_android_scaler_rotate_and_crop_t)
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
+ * - ACaptureRequest
+ *
+ *
+ * This control is primarily intended to help camera applications with no support for
+ * multi-window modes to work correctly on devices where multi-window scenarios are
+ * unavoidable, such as foldables or other devices with variable display geometry or more
+ * free-form window placement (such as laptops, which often place portrait-orientation apps
+ * in landscape with pillarboxing).
+ * If supported, the default value is ROTATE_AND_CROP_AUTO
, which allows the camera API
+ * to enable backwards-compatibility support for applications that do not support resizing
+ * / multi-window modes, when the device is in fact in a multi-window mode (such as inset
+ * portrait on laptops, or on a foldable device in some fold states). In addition,
+ * ROTATE_AND_CROP_NONE
and ROTATE_AND_CROP_90
will always be available if this control
+ * is supported by the device. If not supported, devices API level 30 or higher will always
+ * list only ROTATE_AND_CROP_NONE
.
+ * When CROP_AUTO
is in use, and the camera API activates backward-compatibility mode,
+ * several metadata fields will also be parsed differently to ensure that coordinates are
+ * correctly handled for features like drawing face detection boxes or passing in
+ * tap-to-focus coordinates. The camera API will convert positions in the active array
+ * coordinate system to/from the cropped-and-rotated coordinate system to make the
+ * operation transparent for applications. The following controls are affected:
+ *
+ * - ACAMERA_CONTROL_AE_REGIONS
+ * - ACAMERA_CONTROL_AF_REGIONS
+ * - ACAMERA_CONTROL_AWB_REGIONS
+ * - android.statistics.faces
+ *
+ * Capture results will contain the actual value selected by the API;
+ * ROTATE_AND_CROP_AUTO
will never be seen in a capture result.
+ * Applications can also select their preferred cropping mode, either to opt out of the
+ * backwards-compatibility treatment, or to use the cropping feature themselves as needed.
+ * In this case, no coordinate translation will be done automatically, and all controls
+ * will continue to use the normal active array coordinates.
+ * Cropping and rotating is done after the application of digital zoom (via either
+ * ACAMERA_SCALER_CROP_REGION or ACAMERA_CONTROL_ZOOM_RATIO), but before each individual
+ * output is further cropped and scaled. It only affects processed outputs such as
+ * YUV, PRIVATE, and JPEG. It has no effect on RAW outputs.
+ * When CROP_90
or CROP_270
are selected, there is a significant loss to the field of
+ * view. For example, with a 4:3 aspect ratio output of 1600x1200, CROP_90
will still
+ * produce 1600x1200 output, but these buffers are cropped from a vertical 3:4 slice at the
+ * center of the 4:3 area, then rotated to be 4:3, and then upscaled to 1600x1200. Only
+ * 56.25% of the original FOV is still visible. In general, for an aspect ratio of w:h
,
+ * the crop and rotate operation leaves (h/w)^2
of the field of view visible. For 16:9,
+ * this is ~31.6%.
+ * As a visual example, the figure below shows the effect of ROTATE_AND_CROP_90
on the
+ * outputs for the following parameters:
+ *
+ * - Sensor active array:
2000x1500
+ * - Crop region: top-left:
(500, 375)
, size: (1000, 750)
(4:3 aspect ratio)
+ * - Output streams: YUV
640x480
and YUV 1280x720
+ * ROTATE_AND_CROP_90
+ *
+ *
+ * With these settings, the regions of the active array covered by the output streams are:
+ *
+ * - 640x480 stream crop: top-left:
(219, 375)
, size: (562, 750)
+ * - 1280x720 stream crop: top-left:
(289, 375)
, size: (422, 750)
+ *
+ * Since the buffers are rotated, the buffers as seen by the application are:
+ *
+ * - 640x480 stream: top-left:
(781, 375)
on active array, size: (640, 480)
, downscaled 1.17x from sensor pixels
+ * - 1280x720 stream: top-left:
(711, 375)
on active array, size: (1280, 720)
, upscaled 1.71x from sensor pixels
+ *
+ *
+ * @see ACAMERA_CONTROL_AE_REGIONS
+ * @see ACAMERA_CONTROL_AF_REGIONS
+ * @see ACAMERA_CONTROL_AWB_REGIONS
+ * @see ACAMERA_CONTROL_ZOOM_RATIO
+ * @see ACAMERA_SCALER_CROP_REGION
+ */
+ ACAMERA_SCALER_ROTATE_AND_CROP = // byte (acamera_metadata_enum_android_scaler_rotate_and_crop_t)
+ ACAMERA_SCALER_START + 17,
+ /**
+ * Default YUV/PRIVATE size to use for requesting secure image buffers.
+ *
+ * Type: int32[2]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * This entry lists the default size supported in the secure camera mode. This entry is
+ * optional on devices support the SECURE_IMAGE_DATA capability. This entry will be null
+ * if the camera device does not list SECURE_IMAGE_DATA capability.
+ * When the key is present, only a PRIVATE/YUV output of the specified size is guaranteed
+ * to be supported by the camera HAL in the secure camera mode. Any other format or
+ * resolutions might not be supported. Use
+ * {@link ACameraDevice_isSessionConfigurationSupported }
+ * API to query if a secure session configuration is supported if the device supports this
+ * API.
+ * If this key returns null on a device with SECURE_IMAGE_DATA capability, the application
+ * can assume all output sizes listed in the
+ * {@link ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS }
+ * are supported.
+ */
+ ACAMERA_SCALER_DEFAULT_SECURE_IMAGE_SIZE = // int32[2]
+ ACAMERA_SCALER_START + 18,
+ /**
+ * The available multi-resolution stream configurations that this
+ * physical camera device supports
+ * (i.e. format, width, height, output/input stream).
+ *
+ * Type: int32[n*4] (acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t)
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * This list contains a subset of the parent logical camera's multi-resolution stream
+ * configurations which belong to this physical camera, and it will advertise and will only
+ * advertise the maximum supported resolutions for a particular format.
+ * If this camera device isn't a physical camera device constituting a logical camera,
+ * but a standalone CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ * camera, this field represents the multi-resolution input/output stream configurations of
+ * default mode and max resolution modes. The sizes will be the maximum resolution of a
+ * particular format for default mode and max resolution mode.
+ * This field will only be advertised if the device is a physical camera of a
+ * logical multi-camera device or an ultra high resolution sensor camera. For a logical
+ * multi-camera, the camera API will derive the logical camera’s multi-resolution stream
+ * configurations from all physical cameras. For an ultra high resolution sensor camera, this
+ * is used directly as the camera’s multi-resolution stream configurations.
+ */
+ ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS =
+ // int32[n*4] (acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t)
+ ACAMERA_SCALER_START + 19,
+ /**
+ * The available stream configurations that this
+ * camera device supports (i.e. format, width, height, output/input stream) for a
+ * CaptureRequest with ACAMERA_SENSOR_PIXEL_MODE set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int32[n*4] (acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t)
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, for configurations
+ * which are applicable when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ * Not all output formats may be supported in a configuration with
+ * an input stream of a particular format. For more details, see
+ * android.scaler.availableInputOutputFormatsMapMaximumResolution.
+ *
+ * @see ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION =
+ // int32[n*4] (acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t)
+ ACAMERA_SCALER_START + 20,
+ /**
+ * This lists the minimum frame duration for each
+ * format/size combination when the camera device is sent a CaptureRequest with
+ * ACAMERA_SENSOR_PIXEL_MODE set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int64[4*n]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS, for configurations
+ * which are applicable when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ * When multiple streams are used in a request (if supported, when ACAMERA_SENSOR_PIXEL_MODE
+ * is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION), the
+ * minimum frame duration will be max(individual stream min durations).
+ * See ACAMERA_SENSOR_FRAME_DURATION and
+ * ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION for more details about
+ * calculating the max frame rate.
+ *
+ * @see ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS
+ * @see ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION
+ * @see ACAMERA_SENSOR_FRAME_DURATION
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION =
+ // int64[4*n]
+ ACAMERA_SCALER_START + 21,
+ /**
+ * This lists the maximum stall duration for each
+ * output format/size combination when CaptureRequests are submitted with
+ * ACAMERA_SENSOR_PIXEL_MODE set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int64[4*n]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS, for configurations
+ * which are applicable when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION =
+ // int64[4*n]
+ ACAMERA_SCALER_START + 22,
+ /**
+ * Whether the camera device supports multi-resolution input or output streams
+ *
+ * Type: byte (acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t)
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * A logical multi-camera or an ultra high resolution camera may support multi-resolution
+ * input or output streams. With multi-resolution output streams, the camera device is able
+ * to output different resolution images depending on the current active physical camera or
+ * pixel mode. With multi-resolution input streams, the camera device can reprocess images
+ * of different resolutions from different physical cameras or sensor pixel modes.
+ * When set to TRUE:
+ * * For a logical multi-camera, the camera framework derives
+ * android.scaler.multiResolutionStreamConfigurationMap by combining the
+ * ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS from its physical
+ * cameras.
+ * * For an ultra-high resolution sensor camera, the camera framework directly copies
+ * the value of ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS to
+ * android.scaler.multiResolutionStreamConfigurationMap.
+ *
+ * @see ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS
+ */
+ ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED = // byte (acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t)
+ ACAMERA_SCALER_START + 24,
ACAMERA_SCALER_END,
/**
@@ -4525,6 +4910,67 @@ typedef enum acamera_metadata_tag {
*/
ACAMERA_SENSOR_DYNAMIC_WHITE_LEVEL = // int32
ACAMERA_SENSOR_START + 29,
+ /**
+ * Switches sensor pixel mode between maximum resolution mode and default mode.
+ *
+ * Type: byte (acamera_metadata_enum_android_sensor_pixel_mode_t)
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
+ * - ACaptureRequest
+ *
+ *
+ * This key controls whether the camera sensor operates in
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION
+ * mode or not. By default, all camera devices operate in
+ * CameraMetadata#SENSOR_PIXEL_MODE_DEFAULT mode.
+ * When operating in
+ * CameraMetadata#SENSOR_PIXEL_MODE_DEFAULT mode, sensors
+ * with CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ * capability would typically perform pixel binning in order to improve low light
+ * performance, noise reduction etc. However, in
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION
+ * mode (supported only
+ * by CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ * sensors), sensors typically operate in unbinned mode allowing for a larger image size.
+ * The stream configurations supported in
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION
+ * mode are also different from those of
+ * CameraMetadata#SENSOR_PIXEL_MODE_DEFAULT mode.
+ * They can be queried through
+ * CameraCharacteristics#get with
+ * CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP_MAXIMUM_RESOLUTION).
+ * Unless reported by both
+ * StreamConfigurationMaps, the outputs from
+ * android.scaler.streamConfigurationMapMaximumResolution
and
+ * android.scaler.streamConfigurationMap
+ * must not be mixed in the same CaptureRequest. In other words, these outputs are
+ * exclusive to each other.
+ * This key does not need to be set for reprocess requests.
+ */
+ ACAMERA_SENSOR_PIXEL_MODE = // byte (acamera_metadata_enum_android_sensor_pixel_mode_t)
+ ACAMERA_SENSOR_START + 32,
+ /**
+ * Whether RAW
images requested have their bayer pattern as described by
+ * ACAMERA_SENSOR_INFO_BINNING_FACTOR.
+ *
+ * @see ACAMERA_SENSOR_INFO_BINNING_FACTOR
+ *
+ * Type: byte (acamera_metadata_enum_android_sensor_raw_binning_factor_used_t)
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
+ *
+ *
+ * This key will only be present in devices advertisting the
+ * CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ * capability which also advertise REMOSAIC_REPROCESSING
capability. On all other devices
+ * RAW targets will have a regular bayer pattern.
+ */
+ ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED = // byte (acamera_metadata_enum_android_sensor_raw_binning_factor_used_t)
+ ACAMERA_SENSOR_START + 33,
ACAMERA_SENSOR_END,
/**
@@ -4782,7 +5228,7 @@ typedef enum acamera_metadata_tag {
* rectangle, and cropping to the rectangle given in ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE.
* E.g. to calculate position of a pixel, (x,y), in a processed YUV output image with the
* dimensions in ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE given the position of a pixel,
- * (x', y'), in the raw pixel array with dimensions give in
+ * (x', y'), in the raw pixel array with dimensions given in
* ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE:
*
* - Choose a pixel (x', y') within the active array region of the raw buffer given in
@@ -4826,6 +5272,120 @@ typedef enum acamera_metadata_tag {
*/
ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE = // int32[4]
ACAMERA_SENSOR_INFO_START + 10,
+ /**
+ *
The area of the image sensor which corresponds to active pixels after any geometric
+ * distortion correction has been applied, when the sensor runs in maximum resolution mode.
+ *
+ * Type: int32[4]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE, when ACAMERA_SENSOR_PIXEL_MODE
+ * is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ * Refer to ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE for details, with sensor array related keys
+ * replaced with their
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION
+ * counterparts.
+ * This key will only be present for devices which advertise the
+ * CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ * capability.
+ * The data representation is int[4]
, which maps to (left, top, width, height)
.
+ *
+ * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION = // int32[4]
+ ACAMERA_SENSOR_INFO_START + 11,
+ /**
+ * Dimensions of the full pixel array, possibly
+ * including black calibration pixels, when the sensor runs in maximum resolution mode.
+ * Analogous to ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE, when ACAMERA_SENSOR_PIXEL_MODE is
+ * set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int32[2]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * The pixel count of the full pixel array of the image sensor, which covers
+ * ACAMERA_SENSOR_INFO_PHYSICAL_SIZE area. This represents the full pixel dimensions of
+ * the raw buffers produced by this sensor, when it runs in maximum resolution mode. That
+ * is, when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ * This key will only be present for devices which advertise the
+ * CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ * capability.
+ *
+ * @see ACAMERA_SENSOR_INFO_PHYSICAL_SIZE
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION = // int32[2]
+ ACAMERA_SENSOR_INFO_START + 12,
+ /**
+ * The area of the image sensor which corresponds to active pixels prior to the
+ * application of any geometric distortion correction, when the sensor runs in maximum
+ * resolution mode. This key must be used for crop / metering regions, only when
+ * ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int32[4]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE,
+ * when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ * This key will only be present for devices which advertise the
+ * CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ * capability.
+ * The data representation is int[4]
, which maps to (left, top, width, height)
.
+ *
+ * @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION =
+ // int32[4]
+ ACAMERA_SENSOR_INFO_START + 13,
+ /**
+ * Dimensions of the group of pixels which are under the same color filter.
+ * This specifies the width and height (pair of integers) of the group of pixels which fall
+ * under the same color filter for ULTRA_HIGH_RESOLUTION sensors.
+ *
+ * Type: int32[2]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Sensors can have pixels grouped together under the same color filter in order
+ * to improve various aspects of imaging such as noise reduction, low light
+ * performance etc. These groups can be of various sizes such as 2X2 (quad bayer),
+ * 3X3 (nona-bayer). This key specifies the length and width of the pixels grouped under
+ * the same color filter.
+ * This key will not be present if REMOSAIC_REPROCESSING is not supported, since RAW images
+ * will have a regular bayer pattern.
+ * This key will not be present for sensors which don't have the
+ * CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ * capability.
+ */
+ ACAMERA_SENSOR_INFO_BINNING_FACTOR = // int32[2]
+ ACAMERA_SENSOR_INFO_START + 14,
ACAMERA_SENSOR_INFO_END,
/**
@@ -5226,7 +5786,7 @@ typedef enum acamera_metadata_tag {
*
*
* Since optical image stabilization generally involves motion much faster than the duration
- * of individualq image exposure, multiple OIS samples can be included for a single capture
+ * of individual image exposure, multiple OIS samples can be included for a single capture
* result. For example, if the OIS reporting operates at 200 Hz, a typical camera operating
* at 30fps may have 6-7 OIS samples per capture result. This information can be combined
* with the rolling shutter skew to account for lens motion during image exposure in
@@ -6031,6 +6591,162 @@ typedef enum acamera_metadata_tag {
*/
ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS = // int64[4*n]
ACAMERA_DEPTH_START + 8,
+ /**
+ *
The available depth dataspace stream
+ * configurations that this camera device supports
+ * (i.e. format, width, height, output/input stream) when a CaptureRequest is submitted with
+ * ACAMERA_SENSOR_PIXEL_MODE set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int32[n*4] (acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t)
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS, for configurations which
+ * are applicable when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION =
+ // int32[n*4] (acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t)
+ ACAMERA_DEPTH_START + 9,
+ /**
+ * This lists the minimum frame duration for each
+ * format/size combination for depth output formats when a CaptureRequest is submitted with
+ * ACAMERA_SENSOR_PIXEL_MODE set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int64[4*n]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS, for configurations which
+ * are applicable when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ * See ACAMERA_SENSOR_FRAME_DURATION and
+ * ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION for more details about
+ * calculating the max frame rate.
+ *
+ * @see ACAMERA_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS
+ * @see ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION
+ * @see ACAMERA_SENSOR_FRAME_DURATION
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION =
+ // int64[4*n]
+ ACAMERA_DEPTH_START + 10,
+ /**
+ * This lists the maximum stall duration for each
+ * output format/size combination for depth streams for CaptureRequests where
+ * ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int64[4*n]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS, for configurations which
+ * are applicable when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION =
+ // int64[4*n]
+ ACAMERA_DEPTH_START + 11,
+ /**
+ * The available dynamic depth dataspace stream
+ * configurations that this camera device supports (i.e. format, width, height,
+ * output/input stream) for CaptureRequests where ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int32[n*4] (acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t)
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS, for configurations
+ * which are applicable when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION =
+ // int32[n*4] (acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t)
+ ACAMERA_DEPTH_START + 12,
+ /**
+ * This lists the minimum frame duration for each
+ * format/size combination for dynamic depth output streams for CaptureRequests where
+ * ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int64[4*n]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS, for configurations
+ * which are applicable when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION =
+ // int64[4*n]
+ ACAMERA_DEPTH_START + 13,
+ /**
+ * This lists the maximum stall duration for each
+ * output format/size combination for dynamic depth streams for CaptureRequests where
+ * ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int64[4*n]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Analogous to ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS, for configurations
+ * which are applicable when ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ */
+ ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION =
+ // int64[4*n]
+ ACAMERA_DEPTH_START + 14,
ACAMERA_DEPTH_END,
/**
@@ -6251,6 +6967,71 @@ typedef enum acamera_metadata_tag {
*/
ACAMERA_HEIC_AVAILABLE_HEIC_STALL_DURATIONS = // int64[4*n]
ACAMERA_HEIC_START + 2,
+ /**
+ * The available HEIC (ISO/IEC 23008-12) stream
+ * configurations that this camera device supports
+ * (i.e. format, width, height, output/input stream).
+ *
+ * Type: int32[n*4] (acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t)
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Refer to ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS for details.
+ * All the configuration tuples (format, width, height, input?)
will contain
+ * AIMAGE_FORMAT_HEIC format as OUTPUT only.
+ *
+ * @see ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS
+ */
+ ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION =
+ // int32[n*4] (acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t)
+ ACAMERA_HEIC_START + 3,
+ /**
+ * This lists the minimum frame duration for each
+ * format/size combination for HEIC output formats for CaptureRequests where
+ * ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int64[4*n]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Refer to ACAMERA_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS for details.
+ *
+ * @see ACAMERA_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS
+ */
+ ACAMERA_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION =
+ // int64[4*n]
+ ACAMERA_HEIC_START + 4,
+ /**
+ * This lists the maximum stall duration for each
+ * output format/size combination for HEIC streams for CaptureRequests where
+ * ACAMERA_SENSOR_PIXEL_MODE is set to
+ * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.
+ *
+ * @see ACAMERA_SENSOR_PIXEL_MODE
+ *
+ * Type: int64[4*n]
+ *
+ * This tag may appear in:
+ *
+ * - ACameraMetadata from ACameraManager_getCameraCharacteristics
+ *
+ *
+ * Refer to ACAMERA_HEIC_AVAILABLE_HEIC_STALL_DURATIONS for details.
+ *
+ * @see ACAMERA_HEIC_AVAILABLE_HEIC_STALL_DURATIONS
+ */
+ ACAMERA_HEIC_AVAILABLE_HEIC_STALL_DURATIONS_MAXIMUM_RESOLUTION =
+ // int64[4*n]
+ ACAMERA_HEIC_START + 5,
ACAMERA_HEIC_END,
} acamera_metadata_tag_t;
@@ -8127,13 +8908,27 @@ typedef enum acamera_metadata_enum_acamera_request_available_capabilities {
* camera's crop region is set to maximum size, the FOV of the physical streams for the
* ultrawide lens will be the same as the logical stream, by making the crop region
* smaller than its active array size to compensate for the smaller focal length.
- * Even if the underlying physical cameras have different RAW characteristics (such as
- * size or CFA pattern), a logical camera can still advertise RAW capability. In this
- * case, when the application configures a RAW stream, the camera device will make sure
- * the active physical camera will remain active to ensure consistent RAW output
- * behavior, and not switch to other physical cameras.
+ * There are two ways for the application to capture RAW images from a logical camera
+ * with RAW capability:
+ *
+ * - Because the underlying physical cameras may have different RAW capabilities (such
+ * as resolution or CFA pattern), to maintain backward compatibility, when a RAW stream
+ * is configured, the camera device makes sure the default active physical camera remains
+ * active and does not switch to other physical cameras. (One exception is that, if the
+ * logical camera consists of identical image sensors and advertises multiple focalLength
+ * due to different lenses, the camera device may generate RAW images from different
+ * physical cameras based on the focalLength being set by the application.) This
+ * backward-compatible approach usually results in loss of optical zoom, to telephoto
+ * lens or to ultrawide lens.
+ * - Alternatively, to take advantage of the full zoomRatio range of the logical camera,
+ * the application should use MultiResolutionImageReader
+ * to capture RAW images from the currently active physical camera. Because different
+ * physical camera may have different RAW characteristics, the application needs to use
+ * the characteristics and result metadata of the active physical camera for the
+ * relevant RAW metadata.
+ *
* The capture request and result metadata tags required for backward compatible camera
- * functionalities will be solely based on the logical camera capabiltity. On the other
+ * functionalities will be solely based on the logical camera capability. On the other
* hand, the use of manual capture controls (sensor or post-processing) with a
* logical camera may result in unexpected behavior when the HAL decides to switch
* between physical cameras with different characteristics under the hood. For example,
@@ -8201,6 +8996,25 @@ typedef enum acamera_metadata_enum_acamera_request_available_capabilities {
*/
ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA = 14,
+ /**
+ *
This camera device is capable of producing ultra high resolution images in
+ * addition to the image sizes described in the
+ * android.scaler.streamConfigurationMap.
+ * It can operate in 'default' mode and 'max resolution' mode. It generally does this
+ * by binning pixels in 'default' mode and not binning them in 'max resolution' mode.
+ * android.scaler.streamConfigurationMap
describes the streams supported in 'default'
+ * mode.
+ * The stream configurations supported in 'max resolution' mode are described by
+ * android.scaler.streamConfigurationMapMaximumResolution
.
+ * The maximum resolution mode pixel array size of a camera device
+ * (ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE
) with this capability,
+ * will be at least 24 megapixels.
+ *
+ * @see ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE
+ */
+ ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
+ = 16,
+
} acamera_metadata_enum_android_request_available_capabilities_t;
@@ -8301,6 +9115,79 @@ typedef enum acamera_metadata_enum_acamera_scaler_available_recommended_stream_c
} acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t;
+// ACAMERA_SCALER_ROTATE_AND_CROP
+typedef enum acamera_metadata_enum_acamera_scaler_rotate_and_crop {
+ /**
+ * No rotate and crop is applied. Processed outputs are in the sensor orientation.
+ */
+ ACAMERA_SCALER_ROTATE_AND_CROP_NONE = 0,
+
+ /**
+ * Processed images are rotated by 90 degrees clockwise, and then cropped
+ * to the original aspect ratio.
+ */
+ ACAMERA_SCALER_ROTATE_AND_CROP_90 = 1,
+
+ /**
+ * Processed images are rotated by 180 degrees. Since the aspect ratio does not
+ * change, no cropping is performed.
+ */
+ ACAMERA_SCALER_ROTATE_AND_CROP_180 = 2,
+
+ /**
+ * Processed images are rotated by 270 degrees clockwise, and then cropped
+ * to the original aspect ratio.
+ */
+ ACAMERA_SCALER_ROTATE_AND_CROP_270 = 3,
+
+ /**
+ * The camera API automatically selects the best concrete value for
+ * rotate-and-crop based on the application's support for resizability and the current
+ * multi-window mode.
+ * If the application does not support resizing but the display mode for its main
+ * Activity is not in a typical orientation, the camera API will set ROTATE_AND_CROP_90
+ * or some other supported rotation value, depending on device configuration,
+ * to ensure preview and captured images are correctly shown to the user. Otherwise,
+ * ROTATE_AND_CROP_NONE
will be selected.
+ * When a value other than NONE is selected, several metadata fields will also be parsed
+ * differently to ensure that coordinates are correctly handled for features like drawing
+ * face detection boxes or passing in tap-to-focus coordinates. The camera API will
+ * convert positions in the active array coordinate system to/from the cropped-and-rotated
+ * coordinate system to make the operation transparent for applications.
+ * No coordinate mapping will be done when the application selects a non-AUTO mode.
+ */
+ ACAMERA_SCALER_ROTATE_AND_CROP_AUTO = 4,
+
+} acamera_metadata_enum_android_scaler_rotate_and_crop_t;
+
+// ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS
+typedef enum acamera_metadata_enum_acamera_scaler_physical_camera_multi_resolution_stream_configurations {
+ ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_OUTPUT
+ = 0,
+
+ ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_INPUT
+ = 1,
+
+} acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t;
+
+// ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION
+typedef enum acamera_metadata_enum_acamera_scaler_available_stream_configurations_maximum_resolution {
+ ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT
+ = 0,
+
+ ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT
+ = 1,
+
+} acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t;
+
+// ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED
+typedef enum acamera_metadata_enum_acamera_scaler_multi_resolution_stream_supported {
+ ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_FALSE = 0,
+
+ ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_TRUE = 1,
+
+} acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t;
+
// ACAMERA_SENSOR_REFERENCE_ILLUMINANT1
typedef enum acamera_metadata_enum_acamera_sensor_reference_illuminant1 {
@@ -8373,10 +9260,10 @@ typedef enum acamera_metadata_enum_acamera_sensor_test_pattern_mode {
* respective color channel provided in
* ACAMERA_SENSOR_TEST_PATTERN_DATA.
* For example:
- * android.testPatternData = [0, 0xFFFFFFFF, 0xFFFFFFFF, 0]
+ * ACAMERA_SENSOR_TEST_PATTERN_DATA = [0, 0xFFFFFFFF, 0xFFFFFFFF, 0]
*
* All green pixels are 100% green. All red/blue pixels are black.
- * android.testPatternData = [0xFFFFFFFF, 0, 0xFFFFFFFF, 0]
+ * ACAMERA_SENSOR_TEST_PATTERN_DATA = [0xFFFFFFFF, 0, 0xFFFFFFFF, 0]
*
* All red pixels are 100% red. Only the odd green pixels
* are 100% green. All blue pixels are 100% black.
@@ -8459,6 +9346,42 @@ typedef enum acamera_metadata_enum_acamera_sensor_test_pattern_mode {
} acamera_metadata_enum_android_sensor_test_pattern_mode_t;
+// ACAMERA_SENSOR_PIXEL_MODE
+typedef enum acamera_metadata_enum_acamera_sensor_pixel_mode {
+ /**
+ * This is the default sensor pixel mode. This is the only sensor pixel mode
+ * supported unless a camera device advertises
+ * CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR.
+ */
+ ACAMERA_SENSOR_PIXEL_MODE_DEFAULT = 0,
+
+ /**
+ * This sensor pixel mode is offered by devices with capability
+ * CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR.
+ * In this mode, sensors typically do not bin pixels, as a result can offer larger
+ * image sizes.
+ */
+ ACAMERA_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION = 1,
+
+} acamera_metadata_enum_android_sensor_pixel_mode_t;
+
+// ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED
+typedef enum acamera_metadata_enum_acamera_sensor_raw_binning_factor_used {
+ /**
+ * The RAW
targets in this capture have ACAMERA_SENSOR_INFO_BINNING_FACTOR as the
+ * bayer pattern.
+ *
+ * @see ACAMERA_SENSOR_INFO_BINNING_FACTOR
+ */
+ ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED_TRUE = 0,
+
+ /**
+ * The RAW
targets have a regular bayer pattern in this capture.
+ */
+ ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED_FALSE = 1,
+
+} acamera_metadata_enum_android_sensor_raw_binning_factor_used_t;
+
// ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
typedef enum acamera_metadata_enum_acamera_sensor_info_color_filter_arrangement {
@@ -8943,6 +9866,26 @@ typedef enum acamera_metadata_enum_acamera_depth_available_dynamic_depth_stream_
} acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t;
+// ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION
+typedef enum acamera_metadata_enum_acamera_depth_available_depth_stream_configurations_maximum_resolution {
+ ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT
+ = 0,
+
+ ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT
+ = 1,
+
+} acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t;
+
+// ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION
+typedef enum acamera_metadata_enum_acamera_depth_available_dynamic_depth_stream_configurations_maximum_resolution {
+ ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT
+ = 0,
+
+ ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT
+ = 1,
+
+} acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t;
+
// ACAMERA_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE
typedef enum acamera_metadata_enum_acamera_logical_multi_camera_sensor_sync_type {
@@ -8994,6 +9937,17 @@ typedef enum acamera_metadata_enum_acamera_heic_available_heic_stream_configurat
} acamera_metadata_enum_android_heic_available_heic_stream_configurations_t;
+// ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION
+typedef enum acamera_metadata_enum_acamera_heic_available_heic_stream_configurations_maximum_resolution {
+ ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT
+ = 0,
+
+ ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT
+ = 1,
+
+} acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t;
+
+
__END_DECLS
diff --git a/camera/ndk/include/camera/NdkCameraWindowType.h b/camera/ndk/include/camera/NdkCameraWindowType.h
index 99f67e9a5a59d185da40e9db29cac55009f64752..0838fbad21d589e91787fba20d3079097ef1b534 100644
--- a/camera/ndk/include/camera/NdkCameraWindowType.h
+++ b/camera/ndk/include/camera/NdkCameraWindowType.h
@@ -44,10 +44,12 @@
*/
#ifdef __ANDROID_VNDK__
#include
-typedef native_handle_t ACameraWindowType;
+typedef const native_handle_t ACameraWindowType;
#else
#include
typedef ANativeWindow ACameraWindowType;
#endif
+/** @} */
+
#endif //_NDK_CAMERA_WINDOW_TYPE_H
diff --git a/camera/ndk/include/camera/NdkCaptureRequest.h b/camera/ndk/include/camera/NdkCaptureRequest.h
index a4dc374d376c6f0642bf1fabd4fafe24f58dad8a..d83c5b3fa7c92b70b1535779c428f51033ad8b0d 100644
--- a/camera/ndk/include/camera/NdkCaptureRequest.h
+++ b/camera/ndk/include/camera/NdkCaptureRequest.h
@@ -44,10 +44,10 @@
__BEGIN_DECLS
-// Container for output targets
+/** Container for output targets */
typedef struct ACameraOutputTargets ACameraOutputTargets;
-// Container for a single output target
+/** Container for a single output target */
typedef struct ACameraOutputTarget ACameraOutputTarget;
/**
@@ -383,10 +383,10 @@ camera_status_t ACaptureRequest_getConstEntry_physicalCamera(
* Set/change a camera capture control entry with unsigned 8 bits data type for
* a physical camera backing a logical multi-camera device.
*
- * Same as ACaptureRequest_setEntry_u8, except that if {@link tag} is contained
+ *
Same as ACaptureRequest_setEntry_u8, except that if tag is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* sets the entry for a particular physical sub-camera backing the logical multi-camera.
- * If {@link tag} is not contained in
+ * If tag is not contained in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, the key will be ignored
* by the camera device.
*
@@ -413,10 +413,10 @@ camera_status_t ACaptureRequest_setEntry_physicalCamera_u8(
* Set/change a camera capture control entry with signed 32 bits data type for
* a physical camera of a logical multi-camera device.
*
- * Same as ACaptureRequest_setEntry_i32, except that if {@link tag} is contained
+ *
Same as ACaptureRequest_setEntry_i32, except that if tag is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* sets the entry for a particular physical sub-camera backing the logical multi-camera.
- * If {@link tag} is not contained in
+ * If tag is not contained in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, the key will be ignored
* by the camera device.
*
@@ -443,10 +443,10 @@ camera_status_t ACaptureRequest_setEntry_physicalCamera_i32(
* Set/change a camera capture control entry with float data type for
* a physical camera of a logical multi-camera device.
*
- * Same as ACaptureRequest_setEntry_float, except that if {@link tag} is contained
+ *
Same as ACaptureRequest_setEntry_float, except that if tag is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* sets the entry for a particular physical sub-camera backing the logical multi-camera.
- * If {@link tag} is not contained in
+ * If tag is not contained in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, the key will be ignored
* by the camera device.
*
@@ -473,10 +473,10 @@ camera_status_t ACaptureRequest_setEntry_physicalCamera_float(
* Set/change a camera capture control entry with signed 64 bits data type for
* a physical camera of a logical multi-camera device.
*
- * Same as ACaptureRequest_setEntry_i64, except that if {@link tag} is contained
+ *
Same as ACaptureRequest_setEntry_i64, except that if tag is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* sets the entry for a particular physical sub-camera backing the logical multi-camera.
- * If {@link tag} is not contained in
+ * If tag is not contained in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, the key will be ignored
* by the camera device.
*
@@ -503,10 +503,10 @@ camera_status_t ACaptureRequest_setEntry_physicalCamera_i64(
* Set/change a camera capture control entry with double data type for
* a physical camera of a logical multi-camera device.
*
- * Same as ACaptureRequest_setEntry_double, except that if {@link tag} is contained
+ *
Same as ACaptureRequest_setEntry_double, except that if tag is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* sets the entry for a particular physical sub-camera backing the logical multi-camera.
- * If {@link tag} is not contained in
+ * If tag is not contained in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, the key will be ignored
* by the camera device.
*
@@ -533,10 +533,10 @@ camera_status_t ACaptureRequest_setEntry_physicalCamera_double(
* Set/change a camera capture control entry with rational data type for
* a physical camera of a logical multi-camera device.
*
- * Same as ACaptureRequest_setEntry_rational, except that if {@link tag} is contained
+ *
Same as ACaptureRequest_setEntry_rational, except that if tag is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* sets the entry for a particular physical sub-camera backing the logical multi-camera.
- * If {@link tag} is not contained in
+ * If tag is not contained in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, the key will be ignored
* by the camera device.
*
diff --git a/camera/ndk/ndk_vendor/impl/ACameraCaptureSessionVendor.h b/camera/ndk/ndk_vendor/impl/ACameraCaptureSessionVendor.h
index e1af8c142168c38c4137a6793d1d27e66cd6239a..5a1af797a94510c94f820f5d07cfae66443329ca 100644
--- a/camera/ndk/ndk_vendor/impl/ACameraCaptureSessionVendor.h
+++ b/camera/ndk/ndk_vendor/impl/ACameraCaptureSessionVendor.h
@@ -18,7 +18,7 @@
#include "utils.h"
struct ACaptureSessionOutput {
- explicit ACaptureSessionOutput(native_handle_t* window, bool isShared = false,
+ explicit ACaptureSessionOutput(const native_handle_t* window, bool isShared = false,
const char* physicalCameraId = "") :
mWindow(window), mIsShared(isShared), mPhysicalCameraId(physicalCameraId) {};
diff --git a/camera/ndk/ndk_vendor/impl/ACameraDevice.cpp b/camera/ndk/ndk_vendor/impl/ACameraDevice.cpp
index e511a3f81d9f6eb98347914b47e5d8ab2dc5992a..9f63099152d97e3ab6028e1b816e80a478fb8280 100644
--- a/camera/ndk/ndk_vendor/impl/ACameraDevice.cpp
+++ b/camera/ndk/ndk_vendor/impl/ACameraDevice.cpp
@@ -180,6 +180,7 @@ CameraDevice::createCaptureSession(
const ACaptureRequest* sessionParameters,
const ACameraCaptureSession_stateCallbacks* callbacks,
/*out*/ACameraCaptureSession** session) {
+ nsecs_t startTimeNs = systemTime();
sp currentSession = mCurrentSession.promote();
Mutex::Autolock _l(mDeviceLock);
camera_status_t ret = checkCameraClosedOrErrorLocked();
@@ -193,7 +194,7 @@ CameraDevice::createCaptureSession(
}
// Create new session
- ret = configureStreamsLocked(outputs, sessionParameters);
+ ret = configureStreamsLocked(outputs, sessionParameters, startTimeNs);
if (ret != ACAMERA_OK) {
ALOGE("Fail to create new session. cannot configure streams");
return ret;
@@ -355,7 +356,7 @@ CameraDevice::allocateCaptureRequestLocked(
std::vector requestStreamIdxList;
std::vector requestSurfaceIdxList;
for (auto outputTarget : request->targets->mOutputs) {
- native_handle_t* anw = outputTarget.mWindow;
+ const native_handle_t* anw = outputTarget.mWindow;
bool found = false;
req->mSurfaceList.push_back(anw);
// lookup stream/surface ID
@@ -434,7 +435,7 @@ CameraDevice::allocateACaptureRequest(sp& req, const char* devic
}
pRequest->targets = new ACameraOutputTargets();
for (size_t i = 0; i < req->mSurfaceList.size(); i++) {
- native_handle_t* anw = req->mSurfaceList[i];
+ const native_handle_t* anw = req->mSurfaceList[i];
ACameraOutputTarget outputTarget(anw);
pRequest->targets->mOutputs.insert(outputTarget);
}
@@ -472,7 +473,11 @@ CameraDevice::notifySessionEndOfLifeLocked(ACameraCaptureSession* session) {
}
// No new session, unconfigure now
- camera_status_t ret = configureStreamsLocked(nullptr, nullptr);
+ // Note: The unconfiguration of session won't be accounted for session
+ // latency because a stream configuration with 0 streams won't ever become
+ // active.
+ nsecs_t startTimeNs = systemTime();
+ camera_status_t ret = configureStreamsLocked(nullptr, nullptr, startTimeNs);
if (ret != ACAMERA_OK) {
ALOGE("Unconfigure stream failed. Device might still be configured! ret %d", ret);
}
@@ -598,7 +603,7 @@ CameraDevice::waitUntilIdleLocked() {
camera_status_t
CameraDevice::configureStreamsLocked(const ACaptureSessionOutputContainer* outputs,
- const ACaptureRequest* sessionParameters) {
+ const ACaptureRequest* sessionParameters, nsecs_t startTimeNs) {
ACaptureSessionOutputContainer emptyOutput;
if (outputs == nullptr) {
outputs = &emptyOutput;
@@ -611,7 +616,7 @@ CameraDevice::configureStreamsLocked(const ACaptureSessionOutputContainer* outpu
std::set> outputSet;
for (auto outConfig : outputs->mOutputs) {
- native_handle_t* anw = outConfig.mWindow;
+ const native_handle_t* anw = outConfig.mWindow;
OutputConfigurationWrapper outConfigInsertW;
OutputConfiguration &outConfigInsert = outConfigInsertW.mOutputConfiguration;
outConfigInsert.rotation = utils::convertToHidl(outConfig.mRotation);
@@ -697,7 +702,8 @@ CameraDevice::configureStreamsLocked(const ACaptureSessionOutputContainer* outpu
utils::convertToHidl(params_metadata, &hidlParams);
params.unlock(params_metadata);
}
- remoteRet = mRemote->endConfigure(StreamConfigurationMode::NORMAL_MODE, hidlParams);
+ remoteRet = mRemote->endConfigure_2_1(StreamConfigurationMode::NORMAL_MODE,
+ hidlParams, startTimeNs);
CHECK_TRANSACTION_AND_RET(remoteRet, remoteRet, "endConfigure()")
return ACAMERA_OK;
}
@@ -846,8 +852,7 @@ CameraDevice::onCaptureErrorLocked(
for (auto streamAndWindowId : request->mCaptureRequest.streamAndWindowIds) {
int32_t windowId = streamAndWindowId.windowId;
if (utils::isWindowNativeHandleEqual(windowHandles[windowId],outHandle)) {
- native_handle_t* anw =
- const_cast(windowHandles[windowId].getNativeHandle());
+ const native_handle_t* anw = windowHandles[windowId].getNativeHandle();
ALOGV("Camera %s Lost output buffer for ANW %p frame %" PRId64,
getId(), anw, frameNumber);
@@ -1244,7 +1249,7 @@ void CameraDevice::CallbackHandler::onMessageReceived(
return;
}
- native_handle_t* anw;
+ const native_handle_t* anw;
found = msg->findPointer(kAnwKey, (void**) &anw);
if (!found) {
ALOGE("%s: Cannot find native_handle_t!", __FUNCTION__);
diff --git a/camera/ndk/ndk_vendor/impl/ACameraDevice.h b/camera/ndk/ndk_vendor/impl/ACameraDevice.h
index 7fc699e16e3abb7e6fe81a5339b1199399c19507..0b6c7c83af00fa7d000a2059d2fffa032d4d5a6b 100644
--- a/camera/ndk/ndk_vendor/impl/ACameraDevice.h
+++ b/camera/ndk/ndk_vendor/impl/ACameraDevice.h
@@ -26,7 +26,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -44,7 +44,8 @@ namespace android {
namespace acam {
using ICameraDeviceCallback = frameworks::cameraservice::device::V2_0::ICameraDeviceCallback;
-using ICameraDeviceUser = frameworks::cameraservice::device::V2_0::ICameraDeviceUser;
+using ICameraDeviceUser_2_0 = frameworks::cameraservice::device::V2_0::ICameraDeviceUser;
+using ICameraDeviceUser = frameworks::cameraservice::device::V2_1::ICameraDeviceUser;
using CaptureResultExtras = frameworks::cameraservice::device::V2_0::CaptureResultExtras;
using PhysicalCaptureResultInfo = frameworks::cameraservice::device::V2_0::PhysicalCaptureResultInfo;
using PhysicalCameraSettings = frameworks::cameraservice::device::V2_0::PhysicalCameraSettings;
@@ -201,7 +202,7 @@ class CameraDevice final : public RefBase {
void notifySessionEndOfLifeLocked(ACameraCaptureSession* session);
camera_status_t configureStreamsLocked(const ACaptureSessionOutputContainer* outputs,
- const ACaptureRequest* sessionParameters);
+ const ACaptureRequest* sessionParameters, nsecs_t startTimeNs);
// Input message will be posted and cleared after this returns
void postSessionMsgAndCleanup(sp& msg);
diff --git a/camera/ndk/ndk_vendor/impl/ACameraManager.cpp b/camera/ndk/ndk_vendor/impl/ACameraManager.cpp
index 5aa9c467fb2d0c9662bbcc97d4bbb28f76d1293a..77c934abbecce7e00c71eef8dc667ef0193841af 100644
--- a/camera/ndk/ndk_vendor/impl/ACameraManager.cpp
+++ b/camera/ndk/ndk_vendor/impl/ACameraManager.cpp
@@ -764,15 +764,15 @@ ACameraManager::openCamera(
}
sp callbacks = device->getServiceCallback();
- sp deviceRemote;
+ sp deviceRemote_2_0;
// No way to get package name from native.
// Send a zero length package name and let camera service figure it out from UID
Status status = Status::NO_ERROR;
auto serviceRet = cs->connectDevice(
- callbacks, cameraId, [&status, &deviceRemote](auto s, auto &device) {
+ callbacks, cameraId, [&status, &deviceRemote_2_0](auto s, auto &device) {
status = s;
- deviceRemote = device;
+ deviceRemote_2_0 = device;
});
if (!serviceRet.isOk() || status != Status::NO_ERROR) {
@@ -780,11 +780,18 @@ ACameraManager::openCamera(
delete device;
return utils::convertFromHidl(status);
}
- if (deviceRemote == nullptr) {
+ if (deviceRemote_2_0 == nullptr) {
ALOGE("%s: connect camera device failed! remote device is null", __FUNCTION__);
delete device;
return ACAMERA_ERROR_CAMERA_DISCONNECTED;
}
+ auto castResult = ICameraDeviceUser::castFrom(deviceRemote_2_0);
+ if (!castResult.isOk()) {
+ ALOGE("%s: failed to cast remote device to version 2.1", __FUNCTION__);
+ delete device;
+ return ACAMERA_ERROR_CAMERA_DISCONNECTED;
+ }
+ sp deviceRemote = castResult;
device->setRemoteDevice(deviceRemote);
device->setDeviceMetadataQueues();
*outDevice = device;
diff --git a/camera/ndk/ndk_vendor/impl/ACameraManager.h b/camera/ndk/ndk_vendor/impl/ACameraManager.h
index f25f5cb42576430e19b595e1c7d44375a564b2c0..4663529f6ca294abcfcdacf4786d5294b9329548 100644
--- a/camera/ndk/ndk_vendor/impl/ACameraManager.h
+++ b/camera/ndk/ndk_vendor/impl/ACameraManager.h
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
#include
#include
@@ -38,7 +39,7 @@
namespace android {
namespace acam {
-using ICameraService = frameworks::cameraservice::service::V2_1::ICameraService;
+using ICameraService = frameworks::cameraservice::service::V2_2::ICameraService;
using CameraDeviceStatus = frameworks::cameraservice::service::V2_0::CameraDeviceStatus;
using ICameraServiceListener = frameworks::cameraservice::service::V2_1::ICameraServiceListener;
using PhysicalCameraStatusAndId = frameworks::cameraservice::service::V2_1::PhysicalCameraStatusAndId;
diff --git a/camera/ndk/ndk_vendor/impl/ACaptureRequestVendor.h b/camera/ndk/ndk_vendor/impl/ACaptureRequestVendor.h
index ed676151860efa56bc6fc84631bfa7c096959b50..5715d778770b38e2a5cb17fec589c37cefa9ce19 100644
--- a/camera/ndk/ndk_vendor/impl/ACaptureRequestVendor.h
+++ b/camera/ndk/ndk_vendor/impl/ACaptureRequestVendor.h
@@ -17,7 +17,7 @@
#include "utils.h"
struct ACameraOutputTarget {
- explicit ACameraOutputTarget(native_handle_t* window) : mWindow(window) {};
+ explicit ACameraOutputTarget(const native_handle_t* window) : mWindow(window) {};
bool operator == (const ACameraOutputTarget& other) const {
return mWindow == other.mWindow;
diff --git a/camera/ndk/ndk_vendor/impl/utils.h b/camera/ndk/ndk_vendor/impl/utils.h
index f389f03d792de2f65c3d627716dd6fdf06612cac..6f5820ecee9cc67a8c364862adadf02db04f079c 100644
--- a/camera/ndk/ndk_vendor/impl/utils.h
+++ b/camera/ndk/ndk_vendor/impl/utils.h
@@ -42,7 +42,7 @@ using OutputConfiguration = frameworks::cameraservice::device::V2_0::OutputConfi
// Utility class so that CaptureRequest can be stored by sp<>
struct CaptureRequest : public RefBase {
frameworks::cameraservice::device::V2_0::CaptureRequest mCaptureRequest;
- std::vector mSurfaceList;
+ std::vector mSurfaceList;
//Physical camera settings metadata is stored here, since the capture request
//might not contain it. That's since, fmq might have consumed it.
hidl_vec mPhysicalCameraSettings;
@@ -62,13 +62,13 @@ bool isWindowNativeHandleGreaterThan(const native_handle_t *nh1, const native_ha
// Utility class so the native_handle_t can be compared with its contents instead
// of just raw pointer comparisons.
struct native_handle_ptr_wrapper {
- native_handle_t *mWindow = nullptr;
+ const native_handle_t *mWindow = nullptr;
- native_handle_ptr_wrapper(native_handle_t *nh) : mWindow(nh) { }
+ native_handle_ptr_wrapper(const native_handle_t *nh) : mWindow(nh) { }
native_handle_ptr_wrapper() = default;
- operator native_handle_t *() const { return mWindow; }
+ operator const native_handle_t *() const { return mWindow; }
bool operator ==(const native_handle_ptr_wrapper other) const {
return isWindowNativeHandleEqual(mWindow, other.mWindow);
diff --git a/camera/ndk/ndk_vendor/tests/AImageReaderVendorTest.cpp b/camera/ndk/ndk_vendor/tests/AImageReaderVendorTest.cpp
index 938b5f55b8b61aec309cd0d208d37e765d59f1c8..ba14c5c4fd69fd029016e6870b7d55a1d35022e2 100644
--- a/camera/ndk/ndk_vendor/tests/AImageReaderVendorTest.cpp
+++ b/camera/ndk/ndk_vendor/tests/AImageReaderVendorTest.cpp
@@ -50,7 +50,7 @@ static constexpr int kTestImageHeight = 480;
static constexpr int kTestImageFormat = AIMAGE_FORMAT_YUV_420_888;
using android::hardware::camera::common::V1_0::helper::VendorTagDescriptorCache;
-using ConfiguredWindows = std::set;
+using ConfiguredWindows = std::set;
class CameraHelper {
public:
@@ -60,11 +60,11 @@ class CameraHelper {
struct PhysicalImgReaderInfo {
const char* physicalCameraId;
- native_handle_t* anw;
+ const native_handle_t* anw;
};
// Retaining the error code in case the caller needs to analyze it.
- std::variant initCamera(native_handle_t* imgReaderAnw,
+ std::variant initCamera(const native_handle_t* imgReaderAnw,
const std::vector& physicalImgReaders,
bool usePhysicalSettings) {
ConfiguredWindows configuredWindows;
@@ -257,7 +257,7 @@ class CameraHelper {
ACameraDevice_StateCallbacks mDeviceCb{this, nullptr, nullptr};
ACameraCaptureSession_stateCallbacks mSessionCb{ this, nullptr, nullptr, nullptr};
- native_handle_t* mImgReaderAnw = nullptr; // not owned by us.
+ const native_handle_t* mImgReaderAnw = nullptr; // not owned by us.
// Camera device
ACameraDevice* mDevice = nullptr;
@@ -396,7 +396,7 @@ class ImageReaderTestCase {
return 0;
}
- native_handle_t* getNativeWindow() { return mImgReaderAnw; }
+ const native_handle_t* getNativeWindow() { return mImgReaderAnw; }
int getAcquiredImageCount() {
std::lock_guard lock(mMutex);
diff --git a/camera/tests/CameraBinderTests.cpp b/camera/tests/CameraBinderTests.cpp
index eee05ff4478d3a10412513b97d12e60dccd7d9cc..9f2f430f6246c3a3f8390117e4e4017796b6effd 100644
--- a/camera/tests/CameraBinderTests.cpp
+++ b/camera/tests/CameraBinderTests.cpp
@@ -363,7 +363,8 @@ TEST(CameraServiceBinderTest, CheckBinderCameraService) {
// Check metadata binder call
CameraMetadata metadata;
- res = service->getCameraCharacteristics(cameraId, &metadata);
+ res = service->getCameraCharacteristics(cameraId,
+ /*targetSdkVersion*/__ANDROID_API_FUTURE__, &metadata);
EXPECT_TRUE(res.isOk()) << res;
EXPECT_FALSE(metadata.isEmpty());
@@ -378,8 +379,8 @@ TEST(CameraServiceBinderTest, CheckBinderCameraService) {
sp callbacks(new TestCameraDeviceCallbacks());
sp device;
res = service->connectDevice(callbacks, cameraId, String16("meeeeeeeee!"),
- {}, hardware::ICameraService::USE_CALLING_UID,
- /*out*/&device);
+ {}, hardware::ICameraService::USE_CALLING_UID, /*oomScoreOffset*/ 0,
+ /*targetSdkVersion*/__ANDROID_API_FUTURE__, /*out*/&device);
EXPECT_TRUE(res.isOk()) << res;
ASSERT_NE(nullptr, device.get());
device->disconnect();
@@ -421,8 +422,8 @@ protected:
{
SCOPED_TRACE("openNewDevice");
binder::Status res = service->connectDevice(callbacks, deviceId, String16("meeeeeeeee!"),
- {}, hardware::ICameraService::USE_CALLING_UID,
- /*out*/&device);
+ {}, hardware::ICameraService::USE_CALLING_UID, /*oomScoreOffset*/ 0,
+ /*targetSdkVersion*/__ANDROID_API_FUTURE__, /*out*/&device);
EXPECT_TRUE(res.isOk()) << res;
}
auto p = std::make_pair(callbacks, device);
@@ -517,7 +518,7 @@ TEST_F(CameraClientBinderTest, CheckBinderCameraDeviceUser) {
CameraMetadata sessionParams;
std::vector offlineStreamIds;
res = device->endConfigure(/*isConstrainedHighSpeed*/ false, sessionParams,
- &offlineStreamIds);
+ ns2ms(systemTime()), &offlineStreamIds);
EXPECT_TRUE(res.isOk()) << res;
EXPECT_FALSE(callbacks->hadError());
@@ -629,7 +630,7 @@ TEST_F(CameraClientBinderTest, CheckBinderCameraDeviceUser) {
res = device->deleteStream(streamId);
EXPECT_TRUE(res.isOk()) << res;
res = device->endConfigure(/*isConstrainedHighSpeed*/ false, sessionParams,
- &offlineStreamIds);
+ ns2ms(systemTime()), &offlineStreamIds);
EXPECT_TRUE(res.isOk()) << res;
sleep(/*second*/1); // allow some time for errors to show up, if any
diff --git a/camera/tests/CameraCharacteristicsPermission.cpp b/camera/tests/CameraCharacteristicsPermission.cpp
index 135d2a38571dce4d4354199697c0d2df38c0e4ea..76dc38ccae848bfbdfa1051f963c97bd7d933690 100644
--- a/camera/tests/CameraCharacteristicsPermission.cpp
+++ b/camera/tests/CameraCharacteristicsPermission.cpp
@@ -73,7 +73,8 @@ TEST_F(CameraCharacteristicsPermission, TestCameraPermission) {
CameraMetadata metadata;
std::vector tagsNeedingPermission;
- rc = mCameraService->getCameraCharacteristics(cameraIdStr, &metadata);
+ rc = mCameraService->getCameraCharacteristics(cameraIdStr,
+ /*targetSdkVersion*/__ANDROID_API_FUTURE__, &metadata);
ASSERT_TRUE(rc.isOk());
EXPECT_FALSE(metadata.isEmpty());
EXPECT_EQ(metadata.removePermissionEntries(CAMERA_METADATA_INVALID_VENDOR_ID,
diff --git a/camera/tests/CameraZSLTests.cpp b/camera/tests/CameraZSLTests.cpp
index 02c6e2aed204570aab8c05a8261c53b03dc04196..efd9daebbcc0bd61df1f71f2c489c44ef1af38f0 100644
--- a/camera/tests/CameraZSLTests.cpp
+++ b/camera/tests/CameraZSLTests.cpp
@@ -181,7 +181,8 @@ TEST_F(CameraZSLTests, TestAllPictureSizes) {
}
CameraMetadata metadata;
- rc = mCameraService->getCameraCharacteristics(cameraIdStr, &metadata);
+ rc = mCameraService->getCameraCharacteristics(cameraIdStr,
+ /*targetSdkVersion*/__ANDROID_API_FUTURE__, &metadata);
if (!rc.isOk()) {
// The test is relevant only for cameras with Hal 3.x
// support.
@@ -207,7 +208,8 @@ TEST_F(CameraZSLTests, TestAllPictureSizes) {
rc = mCameraService->connect(this, cameraId,
String16("ZSLTest"), hardware::ICameraService::USE_CALLING_UID,
- hardware::ICameraService::USE_CALLING_PID, &cameraDevice);
+ hardware::ICameraService::USE_CALLING_PID,
+ /*targetSdkVersion*/__ANDROID_API_FUTURE__, &cameraDevice);
EXPECT_TRUE(rc.isOk());
CameraParameters params(cameraDevice->getParameters());
diff --git a/cmds/screenrecord/screenrecord.cpp b/cmds/screenrecord/screenrecord.cpp
index f4fb6266d2d90f38c51f6c9a8e7225a2485628d0..e6e347321d6769b70b9f0c577ffd8862f41b6e74 100644
--- a/cmds/screenrecord/screenrecord.cpp
+++ b/cmds/screenrecord/screenrecord.cpp
@@ -57,7 +57,7 @@
#include
#include
#include
-#include
+#include
#include
#include "screenrecord.h"
@@ -68,7 +68,7 @@ using android::ABuffer;
using android::ALooper;
using android::AMessage;
using android::AString;
-using android::DisplayConfig;
+using android::ui::DisplayMode;
using android::FrameOutput;
using android::IBinder;
using android::IGraphicBufferProducer;
@@ -273,14 +273,11 @@ static status_t setDisplayProjection(
SurfaceComposerClient::Transaction& t,
const sp& dpy,
const ui::DisplayState& displayState) {
- const ui::Size& viewport = displayState.viewport;
-
- // Set the region of the layer stack we're interested in, which in our
- // case is "all of it".
- Rect layerStackRect(viewport);
+ // Set the region of the layer stack we're interested in, which in our case is "all of it".
+ Rect layerStackRect(displayState.layerStackSpaceRect);
// We need to preserve the aspect ratio of the display.
- float displayAspect = viewport.getHeight() / static_cast(viewport.getWidth());
+ float displayAspect = layerStackRect.getHeight() / static_cast(layerStackRect.getWidth());
// Set the way we map the output onto the display surface (which will
@@ -692,27 +689,28 @@ static status_t recordScreen(const char* fileName) {
return err;
}
- DisplayConfig displayConfig;
- err = SurfaceComposerClient::getActiveDisplayConfig(display, &displayConfig);
+ DisplayMode displayMode;
+ err = SurfaceComposerClient::getActiveDisplayMode(display, &displayMode);
if (err != NO_ERROR) {
fprintf(stderr, "ERROR: unable to get display config\n");
return err;
}
- const ui::Size& viewport = displayState.viewport;
+ const ui::Size& layerStackSpaceRect = displayState.layerStackSpaceRect;
if (gVerbose) {
printf("Display is %dx%d @%.2ffps (orientation=%s), layerStack=%u\n",
- viewport.getWidth(), viewport.getHeight(), displayConfig.refreshRate,
- toCString(displayState.orientation), displayState.layerStack);
+ layerStackSpaceRect.getWidth(), layerStackSpaceRect.getHeight(),
+ displayMode.refreshRate, toCString(displayState.orientation),
+ displayState.layerStack);
fflush(stdout);
}
// Encoder can't take odd number as config
if (gVideoWidth == 0) {
- gVideoWidth = floorToEven(viewport.getWidth());
+ gVideoWidth = floorToEven(layerStackSpaceRect.getWidth());
}
if (gVideoHeight == 0) {
- gVideoHeight = floorToEven(viewport.getHeight());
+ gVideoHeight = floorToEven(layerStackSpaceRect.getHeight());
}
// Configure and start the encoder.
@@ -720,7 +718,7 @@ static status_t recordScreen(const char* fileName) {
sp frameOutput;
sp encoderInputSurface;
if (gOutputFormat != FORMAT_FRAMES && gOutputFormat != FORMAT_RAW_FRAMES) {
- err = prepareEncoder(displayConfig.refreshRate, &encoder, &encoderInputSurface);
+ err = prepareEncoder(displayMode.refreshRate, &encoder, &encoderInputSurface);
if (err != NO_ERROR && !gSizeSpecified) {
// fallback is defined for landscape; swap if we're in portrait
@@ -733,7 +731,7 @@ static status_t recordScreen(const char* fileName) {
gVideoWidth, gVideoHeight, newWidth, newHeight);
gVideoWidth = newWidth;
gVideoHeight = newHeight;
- err = prepareEncoder(displayConfig.refreshRate, &encoder, &encoderInputSurface);
+ err = prepareEncoder(displayMode.refreshRate, &encoder, &encoderInputSurface);
}
}
if (err != NO_ERROR) return err;
@@ -1170,14 +1168,14 @@ int main(int argc, char* const argv[]) {
}
break;
case 'd':
- gPhysicalDisplayId = atoll(optarg);
- if (gPhysicalDisplayId == 0) {
+ gPhysicalDisplayId = PhysicalDisplayId(atoll(optarg));
+ if (gPhysicalDisplayId.value == 0) {
fprintf(stderr, "Please specify a valid physical display id\n");
return 2;
} else if (SurfaceComposerClient::
getPhysicalDisplayToken(gPhysicalDisplayId) == nullptr) {
- fprintf(stderr, "Invalid physical display id: %"
- ANDROID_PHYSICAL_DISPLAY_ID_FORMAT "\n", gPhysicalDisplayId);
+ fprintf(stderr, "Invalid physical display id: %s\n",
+ to_string(gPhysicalDisplayId).c_str());
return 2;
}
break;
diff --git a/cmds/stagefright/Android.mk b/cmds/stagefright/Android.mk
index ef4c568764c0c35cb5679ed784c6d2e1f2b9dadd..803c4a477a37242c918e139264f6da6ab1d85354 100644
--- a/cmds/stagefright/Android.mk
+++ b/cmds/stagefright/Android.mk
@@ -16,6 +16,9 @@ LOCAL_SHARED_LIBRARIES := \
libstagefright_foundation libjpeg libui libgui libcutils liblog \
libhidlbase libdatasource libaudioclient \
android.hardware.media.omx@1.0 \
+ framework-permission-aidl-cpp
+
+LOCAL_STATIC_LIBRARIES := framework-permission-aidl-cpp
LOCAL_C_INCLUDES:= \
frameworks/av/media/libstagefright \
@@ -48,7 +51,8 @@ LOCAL_HEADER_LIBRARIES := \
LOCAL_SHARED_LIBRARIES := \
libstagefright libmedia liblog libutils libbinder \
- libstagefright_foundation libdatasource libaudioclient
+ libstagefright_foundation libdatasource libaudioclient \
+ framework-permission-aidl-cpp
LOCAL_C_INCLUDES:= \
frameworks/av/camera/include \
@@ -85,7 +89,8 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_C_INCLUDES:= \
frameworks/av/media/libstagefright \
frameworks/native/include/media/openmax \
- frameworks/native/include/media/hardware
+ frameworks/native/include/media/hardware \
+ framework-permission-aidl-cpp
LOCAL_CFLAGS += -Wno-multichar -Werror -Wall
@@ -113,7 +118,8 @@ LOCAL_HEADER_LIBRARIES := \
LOCAL_SHARED_LIBRARIES := \
libstagefright libmedia liblog libutils libbinder \
- libstagefright_foundation libaudioclient
+ libstagefright_foundation libaudioclient \
+ framework-permission-aidl-cpp
LOCAL_C_INCLUDES:= \
frameworks/av/media/libstagefright \
diff --git a/cmds/stagefright/audioloop.cpp b/cmds/stagefright/audioloop.cpp
index 84a6d6be2ce3d512f0078f43987a2c5c87184d93..4b41ff8095574c06e99340b22e4c9e0c4297015e 100644
--- a/cmds/stagefright/audioloop.cpp
+++ b/cmds/stagefright/audioloop.cpp
@@ -24,6 +24,7 @@
#include
+#include
#include
#include
#include
@@ -38,6 +39,8 @@
using namespace android;
+using content::AttributionSourceState;
+
static void usage(const char* name)
{
fprintf(stderr, "Usage: %s [-d du.ration] [-m] [-w] [-N name] []\n", name);
@@ -110,9 +113,10 @@ int main(int argc, char* argv[])
audio_attributes_t attr = AUDIO_ATTRIBUTES_INITIALIZER;
attr.source = AUDIO_SOURCE_MIC;
+ // TODO b/182392769: use attribution source util
source = new AudioSource(
&attr,
- String16(),
+ AttributionSourceState(),
sampleRate,
channels);
} else {
diff --git a/cmds/stagefright/codec.cpp b/cmds/stagefright/codec.cpp
index 33c46635e275e7b359244226395ae72ba51d44f0..beeab544d54326d731f9761d391a2352cf92167d 100644
--- a/cmds/stagefright/codec.cpp
+++ b/cmds/stagefright/codec.cpp
@@ -39,7 +39,7 @@
#include
#include
#include
-#include
+#include
static void usage(const char *me) {
fprintf(stderr, "usage: %s [-a] use audio\n"
@@ -414,10 +414,10 @@ int main(int argc, char **argv) {
const sp display = SurfaceComposerClient::getInternalDisplayToken();
CHECK(display != nullptr);
- DisplayConfig config;
- CHECK_EQ(SurfaceComposerClient::getActiveDisplayConfig(display, &config), NO_ERROR);
+ ui::DisplayMode mode;
+ CHECK_EQ(SurfaceComposerClient::getActiveDisplayMode(display, &mode), NO_ERROR);
- const ui::Size& resolution = config.resolution;
+ const ui::Size& resolution = mode.resolution;
const ssize_t displayWidth = resolution.getWidth();
const ssize_t displayHeight = resolution.getHeight();
diff --git a/cmds/stagefright/mediafilter.cpp b/cmds/stagefright/mediafilter.cpp
index ca058ab4c54de1ca5d7bca0581d0d018e629e462..67c68e65a3c43d38c0a72c2efb7d744d8fffca26 100644
--- a/cmds/stagefright/mediafilter.cpp
+++ b/cmds/stagefright/mediafilter.cpp
@@ -34,7 +34,7 @@
#include
#include
#include
-#include
+#include
#include "RenderScript.h"
#include "ScriptC_argbtorgba.h"
@@ -752,10 +752,10 @@ int main(int argc, char **argv) {
const android::sp display = SurfaceComposerClient::getInternalDisplayToken();
CHECK(display != nullptr);
- DisplayConfig config;
- CHECK_EQ(SurfaceComposerClient::getActiveDisplayConfig(display, &config), NO_ERROR);
+ ui::DisplayMode mode;
+ CHECK_EQ(SurfaceComposerClient::getActiveDisplayMode(display, &mode), NO_ERROR);
- const ui::Size& resolution = config.resolution;
+ const ui::Size& resolution = mode.resolution;
const ssize_t displayWidth = resolution.getWidth();
const ssize_t displayHeight = resolution.getHeight();
diff --git a/cmds/stagefright/record.cpp b/cmds/stagefright/record.cpp
index 37091c43e13e4fb56373d968db8f11a0fc473f62..098c27865a930c4ac02a6ec04d01ecb3327fbaf6 100644
--- a/cmds/stagefright/record.cpp
+++ b/cmds/stagefright/record.cpp
@@ -259,31 +259,6 @@ int main(int argc, char **argv) {
printf("$\n");
#endif
-#if 0
- CameraSource *source = CameraSource::Create(
- String16(argv[0], strlen(argv[0])));
- source->start();
-
- printf("source = %p\n", source);
-
- for (int i = 0; i < 100; ++i) {
- MediaBuffer *buffer;
- status_t err = source->read(&buffer);
- CHECK_EQ(err, (status_t)OK);
-
- printf("got a frame, data=%p, size=%d\n",
- buffer->data(), buffer->range_length());
-
- buffer->release();
- buffer = NULL;
- }
-
- err = source->stop();
-
- delete source;
- source = NULL;
-#endif
-
if (err != OK && err != ERROR_END_OF_STREAM) {
fprintf(stderr, "record failed: %d\n", err);
return 1;
diff --git a/cmds/stagefright/stream.cpp b/cmds/stagefright/stream.cpp
index 250d26b8b8dbc47ae4a31d0cc71d095a56977993..40b23921997862788225a7048db2d9806377c594 100644
--- a/cmds/stagefright/stream.cpp
+++ b/cmds/stagefright/stream.cpp
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
using namespace android;
@@ -321,10 +321,10 @@ int main(int argc, char **argv) {
const sp display = SurfaceComposerClient::getInternalDisplayToken();
CHECK(display != nullptr);
- DisplayConfig config;
- CHECK_EQ(SurfaceComposerClient::getActiveDisplayConfig(display, &config), NO_ERROR);
+ ui::DisplayMode mode;
+ CHECK_EQ(SurfaceComposerClient::getActiveDisplayMode(display, &mode), NO_ERROR);
- const ui::Size& resolution = config.resolution;
+ const ui::Size& resolution = mode.resolution;
const ssize_t displayWidth = resolution.getWidth();
const ssize_t displayHeight = resolution.getHeight();
diff --git a/drm/TEST_MAPPING b/drm/TEST_MAPPING
index 2595e3eee82880e60037bf93b8702fbd07438863..364289846eadc98495544a096596ea19cae21c5e 100644
--- a/drm/TEST_MAPPING
+++ b/drm/TEST_MAPPING
@@ -1,5 +1,5 @@
{
- "presubmit": [
+ "presubmit-large": [
// The following tests validate codec and drm path.
{
"name": "GtsMediaTestCases",
@@ -9,17 +9,9 @@
},
{
"include-filter": "com.google.android.media.gts.WidevineGenericOpsTests"
- }
- ]
- },
- {
- "name": "GtsExoPlayerTestCases",
- "options" : [
- {
- "include-annotation": "android.platform.test.annotations.SocPresubmit"
},
{
- "include-filter": "com.google.android.exoplayer.gts.DashTest#testWidevine23FpsH264Fixed"
+ "include-filter": "com.google.android.media.gts.WidevineH264PlaybackTests"
}
]
}
diff --git a/drm/drmserver/drmserver.rc b/drm/drmserver/drmserver.rc
index de46fb92e7b0870df1046d244c8e035210f0576c..eb176c13841963b50efdab8b8c7b415c150c6cce 100644
--- a/drm/drmserver/drmserver.rc
+++ b/drm/drmserver/drmserver.rc
@@ -1,5 +1,12 @@
service drm /system/bin/drmserver
+ disabled
class main
user drm
group drm system inet drmrpc readproc
writepid /dev/cpuset/foreground/tasks
+
+on property:drm.service.enabled=true
+ start drm
+
+on property:drm.service.enabled=1
+ start drm
diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp
index b0a441b556273165d5751d10d5b6e99bf72ac073..6cb0a99129137c6f19a5c5db3aa293b9c60cdf9b 100644
--- a/drm/libdrmframework/DrmManagerClientImpl.cpp
+++ b/drm/libdrmframework/DrmManagerClientImpl.cpp
@@ -52,25 +52,11 @@ void DrmManagerClientImpl::remove(int uniqueId) {
const sp& DrmManagerClientImpl::getDrmManagerService() {
Mutex::Autolock lock(sMutex);
if (NULL == sDrmManagerService.get()) {
- char value[PROPERTY_VALUE_MAX];
- if (property_get("drm.service.enabled", value, NULL) == 0) {
- // Drm is undefined for this device
+ sp sm = defaultServiceManager();
+ sp binder = sm->checkService(String16("drm.drmManager"));
+ if (binder == NULL) {
return sDrmManagerService;
}
-
- sp sm = defaultServiceManager();
- sp binder;
- do {
- binder = sm->getService(String16("drm.drmManager"));
- if (binder != 0) {
- break;
- }
- ALOGW("DrmManagerService not published, waiting...");
- struct timespec reqt;
- reqt.tv_sec = 0;
- reqt.tv_nsec = 500000000; //0.5 sec
- nanosleep(&reqt, NULL);
- } while (true);
if (NULL == sDeathNotifier.get()) {
sDeathNotifier = new DeathNotifier();
}
diff --git a/drm/libmediadrm/Android.bp b/drm/libmediadrm/Android.bp
index 5ce724173eab745bc130953ebc11d9013ba7ab61..71df58cae8c8b8220eda58dc70db52f70e781bb6 100644
--- a/drm/libmediadrm/Android.bp
+++ b/drm/libmediadrm/Android.bp
@@ -60,6 +60,7 @@ cc_library {
"android.hardware.drm@1.1",
"android.hardware.drm@1.2",
"android.hardware.drm@1.3",
+ "android.hardware.drm@1.4",
"libhidlallocatorutils",
"libhidlbase",
],
@@ -72,6 +73,7 @@ cc_library {
"android.hardware.drm@1.0",
"android.hardware.drm@1.1",
"android.hardware.drm@1.2",
+ "android.hardware.drm@1.4",
],
cflags: [
diff --git a/drm/libmediadrm/CryptoHal.cpp b/drm/libmediadrm/CryptoHal.cpp
index 18772e04ad246d9d1f53bdbf75371e18381b94c2..e0db1c4378cf84831d56684cab5077103b80d47e 100644
--- a/drm/libmediadrm/CryptoHal.cpp
+++ b/drm/libmediadrm/CryptoHal.cpp
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
using drm::V1_0::BufferType;
using drm::V1_0::DestinationBuffer;
@@ -39,6 +40,7 @@ using drm::V1_0::SharedBuffer;
using drm::V1_0::Status;
using drm::V1_0::SubSample;
+using ::android::DrmUtils::toStatusT;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_handle;
using ::android::hardware::hidl_memory;
@@ -53,42 +55,6 @@ typedef drm::V1_2::Status Status_V1_2;
namespace android {
-static status_t toStatusT(Status status) {
- switch (status) {
- case Status::OK:
- return OK;
- case Status::ERROR_DRM_NO_LICENSE:
- return ERROR_DRM_NO_LICENSE;
- case Status::ERROR_DRM_LICENSE_EXPIRED:
- return ERROR_DRM_LICENSE_EXPIRED;
- case Status::ERROR_DRM_RESOURCE_BUSY:
- return ERROR_DRM_RESOURCE_BUSY;
- case Status::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION:
- return ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION;
- case Status::ERROR_DRM_SESSION_NOT_OPENED:
- return ERROR_DRM_SESSION_NOT_OPENED;
- case Status::ERROR_DRM_CANNOT_HANDLE:
- return ERROR_DRM_CANNOT_HANDLE;
- case Status::ERROR_DRM_DECRYPT:
- return ERROR_DRM_DECRYPT;
- default:
- return UNKNOWN_ERROR;
- }
-}
-
-static status_t toStatusT_1_2(Status_V1_2 status) {
- switch (status) {
- case Status_V1_2::ERROR_DRM_SESSION_LOST_STATE:
- return ERROR_DRM_SESSION_LOST_STATE;;
- case Status_V1_2::ERROR_DRM_FRAME_TOO_LARGE:
- return ERROR_DRM_FRAME_TOO_LARGE;
- case Status_V1_2::ERROR_DRM_INSUFFICIENT_SECURITY:
- return ERROR_DRM_INSUFFICIENT_SECURITY;
- default:
- return toStatusT(static_cast(status));
- }
-}
-
static hidl_vec toHidlVec(const Vector &vector) {
hidl_vec vec;
vec.setToExternal(const_cast(vector.array()), vector.size());
@@ -180,6 +146,9 @@ sp CryptoHal::makeCryptoPlugin(const sp& factory,
plugin = hPlugin;
}
);
+ if (!hResult.isOk()) {
+ mInitCheck = DEAD_OBJECT;
+ }
return plugin;
}
@@ -213,10 +182,8 @@ status_t CryptoHal::createPlugin(const uint8_t uuid[16], const void *data,
}
}
- if (mPlugin == NULL) {
- mInitCheck = ERROR_UNSUPPORTED;
- } else {
- mInitCheck = OK;
+ if (mInitCheck == NO_INIT) {
+ mInitCheck = mPlugin == NULL ? ERROR_UNSUPPORTED : OK;
}
return mInitCheck;
@@ -376,6 +343,7 @@ ssize_t CryptoHal::decrypt(const uint8_t keyId[16], const uint8_t iv[16],
Return hResult;
+ mLock.unlock();
if (mPluginV1_2 != NULL) {
hResult = mPluginV1_2->decrypt_1_2(secure, toHidlArray16(keyId), toHidlArray16(iv),
hMode, hPattern, hSubSamples, hSource, offset, hDestination,
@@ -384,7 +352,7 @@ ssize_t CryptoHal::decrypt(const uint8_t keyId[16], const uint8_t iv[16],
bytesWritten = hBytesWritten;
*errorDetailMsg = toString8(hDetailedError);
}
- err = toStatusT_1_2(status);
+ err = toStatusT(status);
}
);
} else {
@@ -414,7 +382,8 @@ void CryptoHal::notifyResolution(uint32_t width, uint32_t height) {
return;
}
- mPlugin->notifyResolution(width, height);
+ auto hResult = mPlugin->notifyResolution(width, height);
+ ALOGE_IF(!hResult.isOk(), "notifyResolution txn failed %s", hResult.description().c_str());
}
status_t CryptoHal::setMediaDrmSession(const Vector &sessionId) {
@@ -424,7 +393,12 @@ status_t CryptoHal::setMediaDrmSession(const Vector &sessionId) {
return mInitCheck;
}
- return toStatusT(mPlugin->setMediaDrmSession(toHidlVec(sessionId)));
+ auto err = mPlugin->setMediaDrmSession(toHidlVec(sessionId));
+ return err.isOk() ? toStatusT(err) : DEAD_OBJECT;
}
+status_t CryptoHal::getLogMessages(Vector &logs) const {
+ Mutex::Autolock autoLock(mLock);
+ return DrmUtils::GetLogMessages(mPlugin, logs);
+}
} // namespace android
diff --git a/drm/libmediadrm/DrmHal.cpp b/drm/libmediadrm/DrmHal.cpp
index f218041c46fca26fe37752ed87f8fe50a1655a25..40d1e0c4af4ae38722928e5b076a0c1c4e10177a 100644
--- a/drm/libmediadrm/DrmHal.cpp
+++ b/drm/libmediadrm/DrmHal.cpp
@@ -16,13 +16,9 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "DrmHal"
-#include
-
-#include
-
-#include
#include
+#include
#include
#include
#include
@@ -40,7 +36,9 @@
#include
#include
#include
+#include
+#include
#include
using drm::V1_0::KeyedVector;
@@ -55,6 +53,7 @@ using drm::V1_1::SecureStopRelease;
using drm::V1_1::SecurityLevel;
using drm::V1_2::KeySetId;
using drm::V1_2::KeyStatusType;
+using ::android::DrmUtils::toStatusT;
using ::android::hardware::drm::V1_1::DrmMetricGroup;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_string;
@@ -235,58 +234,6 @@ static List> toKeySetIds(const hidl_vec&
return keySetIds;
}
-static status_t toStatusT(Status status) {
- switch (status) {
- case Status::OK:
- return OK;
- break;
- case Status::ERROR_DRM_NO_LICENSE:
- return ERROR_DRM_NO_LICENSE;
- break;
- case Status::ERROR_DRM_LICENSE_EXPIRED:
- return ERROR_DRM_LICENSE_EXPIRED;
- break;
- case Status::ERROR_DRM_SESSION_NOT_OPENED:
- return ERROR_DRM_SESSION_NOT_OPENED;
- break;
- case Status::ERROR_DRM_CANNOT_HANDLE:
- return ERROR_DRM_CANNOT_HANDLE;
- break;
- case Status::ERROR_DRM_INVALID_STATE:
- return ERROR_DRM_INVALID_STATE;
- break;
- case Status::BAD_VALUE:
- return BAD_VALUE;
- break;
- case Status::ERROR_DRM_NOT_PROVISIONED:
- return ERROR_DRM_NOT_PROVISIONED;
- break;
- case Status::ERROR_DRM_RESOURCE_BUSY:
- return ERROR_DRM_RESOURCE_BUSY;
- break;
- case Status::ERROR_DRM_DEVICE_REVOKED:
- return ERROR_DRM_DEVICE_REVOKED;
- break;
- case Status::ERROR_DRM_UNKNOWN:
- default:
- return ERROR_DRM_UNKNOWN;
- break;
- }
-}
-
-static status_t toStatusT_1_2(Status_V1_2 status) {
- switch (status) {
- case Status_V1_2::ERROR_DRM_RESOURCE_CONTENTION:
- return ERROR_DRM_RESOURCE_CONTENTION;
- case Status_V1_2::ERROR_DRM_FRAME_TOO_LARGE:
- return ERROR_DRM_FRAME_TOO_LARGE;
- case Status_V1_2::ERROR_DRM_INSUFFICIENT_SECURITY:
- return ERROR_DRM_INSUFFICIENT_SECURITY;
- default:
- return toStatusT(static_cast(status));
- }
-}
-
Mutex DrmHal::mLock;
struct DrmHal::DrmSessionClient : public aidl::android::media::BnResourceManagerClient {
@@ -370,8 +317,7 @@ void DrmHal::cleanup() {
closeOpenSessions();
Mutex::Autolock autoLock(mLock);
- reportPluginMetrics();
- reportFrameworkMetrics();
+ reportFrameworkMetrics(reportPluginMetrics());
setListener(NULL);
mInitCheck = NO_INIT;
@@ -387,18 +333,19 @@ void DrmHal::cleanup() {
mPlugin.clear();
mPluginV1_1.clear();
mPluginV1_2.clear();
+ mPluginV1_4.clear();
}
std::vector> DrmHal::makeDrmFactories() {
- std::vector> factories(DrmUtils::MakeDrmFactories());
+ static std::vector> factories(DrmUtils::MakeDrmFactories());
if (factories.size() == 0) {
// must be in passthrough mode, load the default passthrough service
auto passthrough = IDrmFactory::getService();
if (passthrough != NULL) {
- ALOGI("makeDrmFactories: using default passthrough drm instance");
+ DrmUtils::LOG2BI("makeDrmFactories: using default passthrough drm instance");
factories.push_back(passthrough);
} else {
- ALOGE("Failed to find any drm factories");
+ DrmUtils::LOG2BE("Failed to find any drm factories");
}
}
return factories;
@@ -414,7 +361,7 @@ sp DrmHal::makeDrmPlugin(const sp& factory,
Return hResult = factory->createPlugin(uuid, appPackageName.string(),
[&](Status status, const sp& hPlugin) {
if (status != Status::OK) {
- ALOGE("Failed to make drm plugin");
+ DrmUtils::LOG2BE(uuid, "Failed to make drm plugin: %d", status);
return;
}
plugin = hPlugin;
@@ -422,7 +369,8 @@ sp DrmHal::makeDrmPlugin(const sp& factory,
);
if (!hResult.isOk()) {
- ALOGE("createPlugin remote call failed");
+ DrmUtils::LOG2BE(uuid, "createPlugin remote call failed: %s",
+ hResult.description().c_str());
}
return plugin;
@@ -616,18 +564,21 @@ status_t DrmHal::createPlugin(const uint8_t uuid[16],
Mutex::Autolock autoLock(mLock);
for (ssize_t i = mFactories.size() - 1; i >= 0; i--) {
- if (mFactories[i]->isCryptoSchemeSupported(uuid)) {
+ auto hResult = mFactories[i]->isCryptoSchemeSupported(uuid);
+ if (hResult.isOk() && hResult) {
auto plugin = makeDrmPlugin(mFactories[i], uuid, appPackageName);
if (plugin != NULL) {
mPlugin = plugin;
mPluginV1_1 = drm::V1_1::IDrmPlugin::castFrom(mPlugin);
mPluginV1_2 = drm::V1_2::IDrmPlugin::castFrom(mPlugin);
+ mPluginV1_4 = drm::V1_4::IDrmPlugin::castFrom(mPlugin);
break;
}
}
}
if (mPlugin == NULL) {
+ DrmUtils::LOG2BE(uuid, "No supported hal instance found");
mInitCheck = ERROR_UNSUPPORTED;
} else {
mInitCheck = OK;
@@ -642,6 +593,7 @@ status_t DrmHal::createPlugin(const uint8_t uuid[16],
mPlugin.clear();
mPluginV1_1.clear();
mPluginV1_2.clear();
+ mPluginV1_4.clear();
}
}
@@ -822,7 +774,7 @@ status_t DrmHal::getKeyRequest(Vector const &sessionId,
defaultUrl = toString8(hDefaultUrl);
*keyRequestType = toKeyRequestType_1_1(hKeyRequestType);
}
- err = toStatusT_1_2(status);
+ err = toStatusT(status);
});
} else if (mPluginV1_1 != NULL) {
hResult = mPluginV1_1->getKeyRequest_1_1(
@@ -936,7 +888,7 @@ status_t DrmHal::getProvisionRequest(String8 const &certType,
Return hResult;
if (mPluginV1_2 != NULL) {
- Return hResult = mPluginV1_2->getProvisionRequest_1_2(
+ hResult = mPluginV1_2->getProvisionRequest_1_2(
toHidlString(certType), toHidlString(certAuthority),
[&](Status_V1_2 status, const hidl_vec& hRequest,
const hidl_string& hDefaultUrl) {
@@ -944,11 +896,11 @@ status_t DrmHal::getProvisionRequest(String8 const &certType,
request = toVector(hRequest);
defaultUrl = toString8(hDefaultUrl);
}
- err = toStatusT_1_2(status);
+ err = toStatusT(status);
}
);
} else {
- Return hResult = mPlugin->getProvisionRequest(
+ hResult = mPlugin->getProvisionRequest(
toHidlString(certType), toHidlString(certAuthority),
[&](Status status, const hidl_vec& hRequest,
const hidl_string& hDefaultUrl) {
@@ -1116,7 +1068,7 @@ status_t DrmHal::getHdcpLevels(DrmPlugin::HdcpLevel *connected,
*connected = toHdcpLevel(hConnected);
*max = toHdcpLevel(hMax);
}
- err = toStatusT_1_2(status);
+ err = toStatusT(status);
});
} else if (mPluginV1_1 != NULL) {
hResult = mPluginV1_1->getHdcpLevels(
@@ -1511,7 +1463,7 @@ status_t DrmHal::signRSA(Vector const &sessionId,
return hResult.isOk() ? err : DEAD_OBJECT;
}
-void DrmHal::reportFrameworkMetrics() const
+std::string DrmHal::reportFrameworkMetrics(const std::string& pluginMetrics) const
{
mediametrics_handle_t item(mediametrics_create("mediadrm"));
mediametrics_setUid(item, mMetrics.GetAppUid());
@@ -1540,21 +1492,26 @@ void DrmHal::reportFrameworkMetrics() const
if (!b64EncodedMetrics.empty()) {
mediametrics_setCString(item, "serialized_metrics", b64EncodedMetrics.c_str());
}
+ if (!pluginMetrics.empty()) {
+ mediametrics_setCString(item, "plugin_metrics", pluginMetrics.c_str());
+ }
if (!mediametrics_selfRecord(item)) {
ALOGE("Failed to self record framework metrics");
}
mediametrics_delete(item);
+ return serializedMetrics;
}
-void DrmHal::reportPluginMetrics() const
+std::string DrmHal::reportPluginMetrics() const
{
Vector metricsVector;
String8 vendor;
String8 description;
+ std::string metricsString;
if (getPropertyStringInternal(String8("vendor"), vendor) == OK &&
getPropertyStringInternal(String8("description"), description) == OK &&
getPropertyByteArrayInternal(String8("metrics"), metricsVector) == OK) {
- std::string metricsString = toBase64StringNoPad(metricsVector.array(),
+ metricsString = toBase64StringNoPad(metricsVector.array(),
metricsVector.size());
status_t res = android::reportDrmPluginMetrics(metricsString, vendor,
description, mMetrics.GetAppUid());
@@ -1562,6 +1519,55 @@ void DrmHal::reportPluginMetrics() const
ALOGE("Metrics were retrieved but could not be reported: %d", res);
}
}
+ return metricsString;
+}
+
+status_t DrmHal::requiresSecureDecoder(const char *mime, bool *required) const {
+ Mutex::Autolock autoLock(mLock);
+ if (mPluginV1_4 == NULL) {
+ return false;
+ }
+ auto hResult = mPluginV1_4->requiresSecureDecoderDefault(hidl_string(mime));
+ if (!hResult.isOk()) {
+ DrmUtils::LOG2BE("requiresSecureDecoder txn failed: %s", hResult.description().c_str());
+ return DEAD_OBJECT;
+ }
+ if (required) {
+ *required = hResult;
+ }
+ return OK;
+}
+
+status_t DrmHal::requiresSecureDecoder(const char *mime, DrmPlugin::SecurityLevel securityLevel,
+ bool *required) const {
+ Mutex::Autolock autoLock(mLock);
+ if (mPluginV1_4 == NULL) {
+ return false;
+ }
+ auto hLevel = toHidlSecurityLevel(securityLevel);
+ auto hResult = mPluginV1_4->requiresSecureDecoder(hidl_string(mime), hLevel);
+ if (!hResult.isOk()) {
+ DrmUtils::LOG2BE("requiresSecureDecoder txn failed: %s", hResult.description().c_str());
+ return DEAD_OBJECT;
+ }
+ if (required) {
+ *required = hResult;
+ }
+ return OK;
+}
+
+status_t DrmHal::setPlaybackId(Vector const &sessionId, const char *playbackId) {
+ Mutex::Autolock autoLock(mLock);
+ if (mPluginV1_4 == NULL) {
+ return ERROR_UNSUPPORTED;
+ }
+ auto err = mPluginV1_4->setPlaybackId(toHidlVec(sessionId), hidl_string(playbackId));
+ return err.isOk() ? toStatusT(err) : DEAD_OBJECT;
+}
+
+status_t DrmHal::getLogMessages(Vector &logs) const {
+ Mutex::Autolock autoLock(mLock);
+ return DrmUtils::GetLogMessages(mPlugin, logs);
}
} // namespace android
diff --git a/drm/libmediadrm/DrmUtils.cpp b/drm/libmediadrm/DrmUtils.cpp
index d85fa61a522661759c42f15f766de322e8b4edd9..0b117a3cd21f828fa7282989cbdc6c38c3bd35cd 100644
--- a/drm/libmediadrm/DrmUtils.cpp
+++ b/drm/libmediadrm/DrmUtils.cpp
@@ -27,6 +27,8 @@
#include
#include
#include
+#include
+#include
#include
#include
@@ -41,6 +43,9 @@
#include
#include
+#include