Revert "Implement HDR image capture and preview"
CTS fails with it.
This reverts commit 5816883e4e3ba1e42281442f53468a539a7c2f59.
Test: run cts -m CtsCameraTestCases -t android.hardware.camera2.cts.ExtendedCameraCharacteristicsTest#testStaticSessionKeys
Change-Id: Iab80e9d043e846aecf8ed9b1ecf1f49110f2b9a5
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
diff --git a/camerax-extensions/src/main/java/androidx/camera/extensions/impl/HdrImageCaptureExtenderImpl.java b/camerax-extensions/src/main/java/androidx/camera/extensions/impl/HdrImageCaptureExtenderImpl.java
index 7755bf6..0a6ff64 100644
--- a/camerax-extensions/src/main/java/androidx/camera/extensions/impl/HdrImageCaptureExtenderImpl.java
+++ b/camerax-extensions/src/main/java/androidx/camera/extensions/impl/HdrImageCaptureExtenderImpl.java
@@ -1,6 +1,5 @@
/*
* Copyright 2019 The Android Open Source Project
- * Copyright (c) 2019-2020 SHIFT GmbH.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,26 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package androidx.camera.extensions.impl;
import android.content.Context;
import android.hardware.camera2.CameraCharacteristics;
-import android.hardware.camera2.CaptureRequest;
import android.util.Pair;
import android.util.Size;
-import com.shift.cameraximpl.Logger;
-import com.shift.cameraximpl.SettableCaptureStage;
-import com.shift.cameraximpl.ShiftCaptureRequestKey;
-import com.shift.cameraximpl.ShiftMetadata;
-
-import java.util.Collections;
-import java.util.List;
-
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import java.util.List;
+
/**
* Stub implementation for HDR image capture use case.
*
@@ -42,108 +33,63 @@
* @since 1.0
*/
public final class HdrImageCaptureExtenderImpl implements ImageCaptureExtenderImpl {
- private static final String TAG = HdrImageCaptureExtenderImpl.class.getSimpleName();
-
- public HdrImageCaptureExtenderImpl() {
- // empty
- }
+ public HdrImageCaptureExtenderImpl() {}
@Override
public boolean isExtensionAvailable(@NonNull String cameraId,
@Nullable CameraCharacteristics cameraCharacteristics) {
- Logger.d(TAG, "isExtensionAvailable(" + cameraId + ", ...)");
-
- // we only support HDR for cameraId 0 and 1
- switch (cameraId) {
- case "0":
- case "1":
- return true;
- default:
- return false;
- }
+ // TODO: implement if you are cool enough
+ return false;
}
@Override
public void init(String cameraId, CameraCharacteristics cameraCharacteristics) {
- Logger.d(TAG, "enableExtension");
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public CaptureProcessorImpl getCaptureProcessor() {
- Logger.d(TAG, "getCaptureProcessor");
-
- return null;
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public List<CaptureStageImpl> getCaptureStages() {
- Logger.d(TAG, "getCaptureStages");
-
- final SettableCaptureStage captureStage = new SettableCaptureStage(0);
- captureStage
- .addCaptureRequestParameters(ShiftCaptureRequestKey.SESSION_OPERATION_MODE, ShiftMetadata.Session.TYPE_HDR)
- .addCaptureRequestParameters(CaptureRequest.CONTROL_MODE, CaptureRequest.CONTROL_MODE_USE_SCENE_MODE)
- .addCaptureRequestParameters(CaptureRequest.CONTROL_SCENE_MODE, CaptureRequest.CONTROL_SCENE_MODE_HDR)
- .addCaptureRequestParameters(ShiftCaptureRequestKey.HDR_CAPTURE_ENABLE, 1)
- .addCaptureRequestParameters(ShiftCaptureRequestKey.NOISE_REDUCTION_ENABLE, (byte) 0x01)
- ;
-
- return Collections.singletonList((CaptureStageImpl) captureStage);
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public int getMaxCaptureStage() {
- Logger.d(TAG, "getMaxCaptureStage");
-
- return 1;
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
- public void onInit(String cameraId, CameraCharacteristics cameraCharacteristics, Context context) {
- Logger.d(TAG, "onInit");
+ public void onInit(String cameraId, CameraCharacteristics cameraCharacteristics,
+ Context context) {
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public void onDeInit() {
- Logger.d(TAG, "onDeInit");
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public CaptureStageImpl onPresetSession() {
- Logger.d(TAG, "onPresetSession");
-
- final SettableCaptureStage presetSessionStage = new SettableCaptureStage(0);
- presetSessionStage
- .addCaptureRequestParameters(ShiftCaptureRequestKey.SESSION_OPERATION_MODE, ShiftMetadata.Session.TYPE_HDR)
- ;
-
- return presetSessionStage;
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public CaptureStageImpl onEnableSession() {
- Logger.d(TAG, "onEnableSession");
-
- final SettableCaptureStage enableSessionStage = new SettableCaptureStage(0);
- enableSessionStage
- .addCaptureRequestParameters(ShiftCaptureRequestKey.SESSION_OPERATION_MODE, ShiftMetadata.Session.TYPE_HDR)
- ;
-
- return enableSessionStage;
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public CaptureStageImpl onDisableSession() {
- Logger.d(TAG, "onDisableSession");
-
- return null;
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public List<Pair<Integer, Size[]>> getSupportedResolutions() {
- Logger.d(TAG, "getSupportedResolutions");
-
- // we support any resolution
- return null;
+ throw new RuntimeException("Stub, replace with implementation.");
}
}
diff --git a/camerax-extensions/src/main/java/androidx/camera/extensions/impl/HdrPreviewExtenderImpl.java b/camerax-extensions/src/main/java/androidx/camera/extensions/impl/HdrPreviewExtenderImpl.java
index bd13978..e890d2e 100644
--- a/camerax-extensions/src/main/java/androidx/camera/extensions/impl/HdrPreviewExtenderImpl.java
+++ b/camerax-extensions/src/main/java/androidx/camera/extensions/impl/HdrPreviewExtenderImpl.java
@@ -1,6 +1,5 @@
/*
* Copyright 2019 The Android Open Source Project
- * Copyright (c) 2019-2020 SHIFT GmbH.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,16 +21,11 @@
import android.util.Pair;
import android.util.Size;
-import com.shift.cameraximpl.Logger;
-import com.shift.cameraximpl.SettableCaptureStage;
-import com.shift.cameraximpl.ShiftCaptureRequestKey;
-import com.shift.cameraximpl.ShiftMetadata;
-
-import java.util.List;
-
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import java.util.List;
+
/**
* Stub implementation for HDR preview use case.
*
@@ -40,105 +34,64 @@
* @since 1.0
*/
public final class HdrPreviewExtenderImpl implements PreviewExtenderImpl {
- private static final String TAG = HdrPreviewExtenderImpl.class.getSimpleName();
-
public HdrPreviewExtenderImpl() {
- // empty
}
@Override
public boolean isExtensionAvailable(@NonNull String cameraId,
@Nullable CameraCharacteristics cameraCharacteristics) {
- Logger.d(TAG, "isExtensionAvailable(" + cameraId + ", ...)");
-
- // we only support HDR for cameraId 0 and 1
- switch (cameraId) {
- case "0":
- case "1":
- return true;
- default:
- return false;
- }
+ // TODO: implement if you are cool enough
+ return false;
}
@Override
public void init(String cameraId, CameraCharacteristics cameraCharacteristics) {
- Logger.d(TAG, "enableExtension");
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public CaptureStageImpl getCaptureStage() {
- Logger.d(TAG, "getCaptureStage");
-
- final SettableCaptureStage captureStage = new SettableCaptureStage(0);
- captureStage
- .addCaptureRequestParameters(ShiftCaptureRequestKey.SESSION_OPERATION_MODE, ShiftMetadata.Session.TYPE_HDR)
- ;
-
- return captureStage;
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public ProcessorType getProcessorType() {
- Logger.d(TAG, "getProcessorType");
-
- return ProcessorType.PROCESSOR_TYPE_NONE;
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public ProcessorImpl getProcessor() {
- Logger.d(TAG, "getProcessor");
-
- return null;
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public void onInit(String cameraId, CameraCharacteristics cameraCharacteristics,
Context context) {
- Logger.d(TAG, "onInit");
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public void onDeInit() {
- Logger.d(TAG, "onDeInit");
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public CaptureStageImpl onPresetSession() {
- Logger.d(TAG, "onPresetSession");
-
- final SettableCaptureStage presetSessionStage = new SettableCaptureStage(0);
- presetSessionStage
- .addCaptureRequestParameters(ShiftCaptureRequestKey.SESSION_OPERATION_MODE, ShiftMetadata.Session.TYPE_HDR)
- ;
-
- return presetSessionStage;
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public CaptureStageImpl onEnableSession() {
- Logger.d(TAG, "onEnableSession");
-
- final SettableCaptureStage enableSessionStage = new SettableCaptureStage(0);
- enableSessionStage
- .addCaptureRequestParameters(ShiftCaptureRequestKey.SESSION_OPERATION_MODE, ShiftMetadata.Session.TYPE_HDR)
- ;
-
- return enableSessionStage;
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public CaptureStageImpl onDisableSession() {
- Logger.d(TAG, "onDisableSession");
-
- return null;
+ throw new RuntimeException("Stub, replace with implementation.");
}
@Override
public List<Pair<Integer, Size[]>> getSupportedResolutions() {
- Logger.d(TAG, "getSupportedResolutions");
-
- // we support any resolution
- return null;
+ throw new RuntimeException("Stub, replace with implementation.");
}
}
diff --git a/camerax-extensions/src/main/java/com/shift/cameraximpl/Logger.java b/camerax-extensions/src/main/java/com/shift/cameraximpl/Logger.java
deleted file mode 100644
index 9527350..0000000
--- a/camerax-extensions/src/main/java/com/shift/cameraximpl/Logger.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2019-2020 SHIFT GmbH.
- *
- * 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 com.shift.cameraximpl;
-
-import android.util.Log;
-
-public final class Logger {
- private static final boolean ENABLED = true;
-
- private Logger() {
- // empty
- }
-
- public static void d(final String tag, final String message) {
- if (ENABLED) Log.d(tag, message);
- }
-}
diff --git a/camerax-extensions/src/main/java/com/shift/cameraximpl/SettableCaptureStage.java b/camerax-extensions/src/main/java/com/shift/cameraximpl/SettableCaptureStage.java
index 6260e38..ad8a0ae 100644
--- a/camerax-extensions/src/main/java/com/shift/cameraximpl/SettableCaptureStage.java
+++ b/camerax-extensions/src/main/java/com/shift/cameraximpl/SettableCaptureStage.java
@@ -38,9 +38,8 @@
this.mId = id;
}
- public SettableCaptureStage addCaptureRequestParameters(CaptureRequest.Key requestKey, Object requestObject) {
+ public void addCaptureRequestParameters(CaptureRequest.Key requestKey, Object requestObject) {
this.mCaptureRequestKeyValueMap.put(requestKey, requestObject);
- return this;
}
@Override
diff --git a/camerax-extensions/src/main/java/com/shift/cameraximpl/ShiftCaptureRequestKey.java b/camerax-extensions/src/main/java/com/shift/cameraximpl/ShiftCaptureRequestKey.java
deleted file mode 100644
index 3eda551..0000000
--- a/camerax-extensions/src/main/java/com/shift/cameraximpl/ShiftCaptureRequestKey.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2019-2020 SHIFT GmbH.
- *
- * 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 com.shift.cameraximpl;
-
-import android.hardware.camera2.CaptureRequest;
-
-public final class ShiftCaptureRequestKey {
- public static final CaptureRequest.Key<Integer> HDR_CAPTURE_ENABLE;
- public static final CaptureRequest.Key<Byte> NOISE_REDUCTION_ENABLE;
- public static final CaptureRequest.Key<Integer> SESSION_OPERATION_MODE;
-
- static {
- HDR_CAPTURE_ENABLE = new CaptureRequest.Key<>("com.shift.capture.hdr.enable", Integer.class);
- NOISE_REDUCTION_ENABLE = new CaptureRequest.Key<>("org.quic.camera.CustomNoiseReduction.CustomNoiseReduction", Byte.class);
- SESSION_OPERATION_MODE = new CaptureRequest.Key<>("com.shift.session.operation_mode", Integer.class);
- }
-
- private ShiftCaptureRequestKey() {
- // empty
- }
-}
diff --git a/camerax-extensions/src/main/java/com/shift/cameraximpl/ShiftMetadata.java b/camerax-extensions/src/main/java/com/shift/cameraximpl/ShiftMetadata.java
deleted file mode 100644
index f3a1462..0000000
--- a/camerax-extensions/src/main/java/com/shift/cameraximpl/ShiftMetadata.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2019-2020 SHIFT GmbH.
- *
- * 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 com.shift.cameraximpl;
-
-public final class ShiftMetadata {
- private ShiftMetadata() {
- // empty
- }
-
- public static final class Session {
- public static final Integer TYPE_HDR = 0x8001;
- }
-}