diff options
author | Timothy Knight <tknight@google.com> | 2014-10-14 20:28:37 -0700 |
---|---|---|
committer | Timothy Knight <tknight@google.com> | 2014-10-15 17:50:51 +0000 |
commit | 2760cd5bc10f76cab96bd3fe7525bda6ed9328e9 (patch) | |
tree | d28d9d10498430b85577d96cd93ac3394169cd1c /apps | |
parent | 5856373737de05e520e22f01d240716f998e2519 (diff) | |
download | pdk-2760cd5bc10f76cab96bd3fe7525bda6ed9328e9.tar.gz |
CameraITS: Removed usage of internal interfaces
Bug: 17994909
Change-Id: I361c6252a9fe73ef29767c051bbc464c42ae1f37
Diffstat (limited to 'apps')
6 files changed, 21 insertions, 104 deletions
diff --git a/apps/CameraITS/pymodules/its/objects.py b/apps/CameraITS/pymodules/its/objects.py index 5cb2f8e..4b9a811 100644 --- a/apps/CameraITS/pymodules/its/objects.py +++ b/apps/CameraITS/pymodules/its/objects.py @@ -131,8 +131,9 @@ def get_available_output_sizes(fmt, props): Returns: A sorted list of (w,h) tuples (sorted large-to-small). """ - fmt_codes = {"raw":0x20, "yuv":0x23, "jpg":0x21, "jpeg":0x21} - configs = props['android.scaler.availableStreamConfigurations'] + fmt_codes = {"raw":0x20, "yuv":0x23, "jpg":0x100, "jpeg":0x100} + configs = props['android.scaler.streamConfigurationMap']\ + ['availableStreamConfigurations'] fmt_configs = [cfg for cfg in configs if cfg['format'] == fmt_codes[fmt]] out_configs = [cfg for cfg in fmt_configs if cfg['input'] == False] out_sizes = [(cfg['width'],cfg['height']) for cfg in out_configs] diff --git a/apps/CameraITS/service/Android.mk b/apps/CameraITS/service/Android.mk index 6746219..5bb67a1 100644 --- a/apps/CameraITS/service/Android.mk +++ b/apps/CameraITS/service/Android.mk @@ -20,7 +20,7 @@ include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional -#LOCAL_SDK_VERSION := current +LOCAL_SDK_VERSION := current LOCAL_STATIC_JAVA_LIBRARIES := android-ex-camera2 diff --git a/apps/CameraITS/service/AndroidManifest.xml b/apps/CameraITS/service/AndroidManifest.xml index 8a5e7d5..1dcadd5 100644 --- a/apps/CameraITS/service/AndroidManifest.xml +++ b/apps/CameraITS/service/AndroidManifest.xml @@ -17,10 +17,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" - android:versionCode="1" - android:versionName="1.0" package="com.android.camera2.its"> - <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19"/> <uses-feature android:name="android.hardware.camera" android:required="true"/> <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" /> <uses-feature android:name="android.hardware.camera.flash" android:required="false"/> diff --git a/apps/CameraITS/service/src/com/android/camera2/its/ItsSerializer.java b/apps/CameraITS/service/src/com/android/camera2/its/ItsSerializer.java index 4e2530e..987976c 100644 --- a/apps/CameraITS/service/src/com/android/camera2/its/ItsSerializer.java +++ b/apps/CameraITS/service/src/com/android/camera2/its/ItsSerializer.java @@ -27,12 +27,9 @@ import android.hardware.camera2.TotalCaptureResult; import android.hardware.camera2.params.BlackLevelPattern; import android.hardware.camera2.params.ColorSpaceTransform; import android.hardware.camera2.params.Face; -import android.hardware.camera2.params.HighSpeedVideoConfiguration; import android.hardware.camera2.params.LensShadingMap; import android.hardware.camera2.params.MeteringRectangle; import android.hardware.camera2.params.RggbChannelVector; -import android.hardware.camera2.params.StreamConfiguration; -import android.hardware.camera2.params.StreamConfigurationDuration; import android.hardware.camera2.params.StreamConfigurationMap; import android.hardware.camera2.params.TonemapCurve; import android.location.Location; @@ -126,72 +123,29 @@ public class ItsSerializer { } @SuppressWarnings("unchecked") - private static Object serializeStreamConfiguration( - StreamConfiguration cfg) - throws org.json.JSONException { - JSONObject cfgObj = new JSONObject(); - cfgObj.put("format", cfg.getFormat()); - cfgObj.put("width", cfg.getWidth()); - cfgObj.put("height", cfg.getHeight()); - cfgObj.put("input", cfg.isInput()); - return cfgObj; - } - - @SuppressWarnings("unchecked") - private static Object serializeStreamConfigurationDuration( - StreamConfigurationDuration dur) - throws org.json.JSONException { - JSONObject durObj = new JSONObject(); - durObj.put("format", dur.getFormat()); - durObj.put("width", dur.getWidth()); - durObj.put("height", dur.getHeight()); - durObj.put("duration", dur.getDuration()); - return durObj; - } - - @SuppressWarnings("unchecked") - private static Object serializeHighSpeedVideoConfiguration( - HighSpeedVideoConfiguration cfg) - throws org.json.JSONException { - JSONObject cfgObj = new JSONObject(); - cfgObj.put("width", cfg.getWidth()); - cfgObj.put("height", cfg.getHeight()); - cfgObj.put("fpsMin", cfg.getFpsMin()); - cfgObj.put("fpsMax", cfg.getFpsMax()); - return cfgObj; - } - - @SuppressWarnings("unchecked") private static Object serializeStreamConfigurationMap( StreamConfigurationMap map) throws org.json.JSONException { + // TODO: Serialize the rest of the StreamConfigurationMap fields. JSONObject mapObj = new JSONObject(); - - // TODO: Finish serializeStreamConfigurationMap. - // The code below doesn't seem to work properly; it returns an empty list. - /* - JSONArray durArray = new JSONArray(); + JSONArray cfgArray = new JSONArray(); int fmts[] = map.getOutputFormats(); if (fmts != null) { - for (int f = 0; f < Array.getLength(fmts); f++) { - Size sizes[] = map.getOutputSizes(f); + for (int fi = 0; fi < Array.getLength(fmts); fi++) { + Size sizes[] = map.getOutputSizes(fmts[fi]); if (sizes != null) { - for (int s = 0; s < Array.getLength(sizes); s++) { - long minDur = map.getOutputMinFrameDuration(fmts[f], sizes[s]); - long stallDur = map.getOutputStallDuration(fmts[f], sizes[s]); - JSONObject durObj = new JSONObject(); - durObj.put("format", fmts[f]); - durObj.put("size", serializeSize(sizes[s])); - durObj.put("minFrameDuration", minDur); - durObj.put("stallDiration", stallDur); - durArray.put(durObj); + for (int si = 0; si < Array.getLength(sizes); si++) { + JSONObject obj = new JSONObject(); + obj.put("format", fmts[fi]); + obj.put("width",sizes[si].getWidth()); + obj.put("height", sizes[si].getHeight()); + obj.put("input", false); + cfgArray.put(obj); } } } } - mapObj.put("durations", durArray); - */ - + mapObj.put("availableStreamConfigurations", cfgArray); return mapObj; } @@ -350,13 +304,6 @@ public class ItsSerializer { return new MetadataEntry(keyName, serializeRect((Rect)keyValue)); } else if (keyType == Face.class) { return new MetadataEntry(keyName, serializeFace((Face)keyValue)); - } else if (keyType == StreamConfiguration.class) { - return new MetadataEntry(keyName, - serializeStreamConfiguration((StreamConfiguration)keyValue)); - } else if (keyType == StreamConfigurationDuration.class) { - return new MetadataEntry(keyName, - serializeStreamConfigurationDuration( - (StreamConfigurationDuration)keyValue)); } else if (keyType == StreamConfigurationMap.class) { return new MetadataEntry(keyName, serializeStreamConfigurationMap((StreamConfigurationMap)keyValue)); @@ -387,16 +334,9 @@ public class ItsSerializer { } else if (keyType == LensShadingMap.class) { return new MetadataEntry(keyName, serializeLensShadingMap((LensShadingMap)keyValue)); - } else if (keyType == HighSpeedVideoConfiguration.class) { - return new MetadataEntry(keyName, - serializeHighSpeedVideoConfiguration( - (HighSpeedVideoConfiguration)keyValue)); - } else if (keyType instanceof ParameterizedType && - ((ParameterizedType)keyType).getRawType() == Pair.class) { - return new MetadataEntry(keyName, serializePair((Pair)keyValue)); } else { - throw new ItsException( - "Unsupported key type in metadata serializer: " + keyType); + Logt.w(TAG, String.format("Serializing unsupported key type: " + keyType)); + return null; } } catch (org.json.JSONException e) { throw new ItsException("JSON error for key: " + keyName + ": ", e); @@ -441,20 +381,6 @@ public class ItsSerializer { jsonArray.put(serializeFace((Face)Array.get(keyValue, i))); } return new MetadataEntry(keyName, jsonArray); - } else if (elmtType == StreamConfiguration.class) { - JSONArray jsonArray = new JSONArray(); - for (int i = 0; i < arrayLen; i++) { - jsonArray.put(serializeStreamConfiguration( - (StreamConfiguration)Array.get(keyValue,i))); - } - return new MetadataEntry(keyName, jsonArray); - } else if (elmtType == StreamConfigurationDuration.class) { - JSONArray jsonArray = new JSONArray(); - for (int i = 0; i < arrayLen; i++) { - jsonArray.put(serializeStreamConfigurationDuration( - (StreamConfigurationDuration)Array.get(keyValue,i))); - } - return new MetadataEntry(keyName, jsonArray); } else if (elmtType == StreamConfigurationMap.class) { JSONArray jsonArray = new JSONArray(); for (int i = 0; i < arrayLen; i++) { @@ -503,13 +429,6 @@ public class ItsSerializer { (BlackLevelPattern)Array.get(keyValue,i))); } return new MetadataEntry(keyName, jsonArray); - } else if (elmtType == HighSpeedVideoConfiguration.class) { - JSONArray jsonArray = new JSONArray(); - for (int i = 0; i < arrayLen; i++) { - jsonArray.put(serializeHighSpeedVideoConfiguration( - (HighSpeedVideoConfiguration)Array.get(keyValue,i))); - } - return new MetadataEntry(keyName, jsonArray); } else if (elmtType == Point.class) { JSONArray jsonArray = new JSONArray(); for (int i = 0; i < arrayLen; i++) { @@ -517,7 +436,8 @@ public class ItsSerializer { } return new MetadataEntry(keyName, jsonArray); } else { - throw new ItsException("Unsupported array type: " + elmtType); + Logt.w(TAG, String.format("Serializing unsupported array type: " + elmtType)); + return null; } } catch (org.json.JSONException e) { throw new ItsException("JSON error for key: " + keyName + ": ", e); diff --git a/apps/CameraITS/service/src/com/android/camera2/its/ItsUtils.java b/apps/CameraITS/service/src/com/android/camera2/its/ItsUtils.java index 0a5747e..8d330cf 100644 --- a/apps/CameraITS/service/src/com/android/camera2/its/ItsUtils.java +++ b/apps/CameraITS/service/src/com/android/camera2/its/ItsUtils.java @@ -23,7 +23,6 @@ import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CaptureRequest; import android.hardware.camera2.CaptureResult; import android.hardware.camera2.params.MeteringRectangle; -import android.hardware.camera2.params.StreamConfiguration; import android.hardware.camera2.params.StreamConfigurationMap; import android.media.Image; import android.media.Image.Plane; diff --git a/apps/CameraITS/tests/scene0/test_camera_properties.py b/apps/CameraITS/tests/scene0/test_camera_properties.py index 5f3b165..274c388 100644 --- a/apps/CameraITS/tests/scene0/test_camera_properties.py +++ b/apps/CameraITS/tests/scene0/test_camera_properties.py @@ -27,7 +27,7 @@ def main(): # Test that a handful of required keys are present. assert(props.has_key('android.sensor.info.sensitivityRange')) assert(props.has_key('android.sensor.orientation')) - assert(props.has_key('android.scaler.availableStreamConfigurations')) + assert(props.has_key('android.scaler.streamConfigurationMap')) assert(props.has_key('android.lens.facing')) print "JPG sizes:", its.objects.get_available_output_sizes("jpg", props) |