From 5743868e15c88d2886915163652a1571a218bf39 Mon Sep 17 00:00:00 2001 From: Igor Murashkin Date: Fri, 30 May 2014 10:49:00 -0700 Subject: camera2: Change android.lens.focusRange to Pair Since the focus range is defined in diopters (1/distance), it just so happens that in a range [near, far] near >= far which is against the android.util.Range contract. Change it to pair instead. Also adds a marshaler for Pairs since they didn't have one before (and aren't parcelable). Bug: 15335269 Change-Id: If2f3259aeec072438a1c18c1b9728a4c81e92a40 --- .../mediaframeworktest/unit/CameraMetadataTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'media') diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java index afc2931..ef06d2c 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java @@ -18,6 +18,7 @@ package com.android.mediaframeworktest.unit; import android.test.suitebuilder.annotation.SmallTest; import android.util.Log; +import android.util.Pair; import android.util.Range; import android.util.Rational; import android.util.SizeF; @@ -790,6 +791,22 @@ public class CameraMetadataTest extends junit.framework.TestCase { } @SmallTest + public void testReadWritePair() { + // float x 2 + checkKeyMarshal("android.lens.focusRange", + new TypeReference>() {{ }}, + Pair.create(1.0f / 2.0f, 1.0f / 3.0f), + toByteArray(1.0f / 2.0f, 1.0f / 3.0f)); + + // byte, int (fake from TYPE_BYTE) + // This takes advantage of the TYPE_BYTE -> int marshaler designed for enums. + checkKeyMarshal("android.flash.mode", + new TypeReference>() {{ }}, + Pair.create((byte)123, 22), + toByteArray((byte)123, (byte)22)); + } + + @SmallTest public void testReadWriteRange() { // int32 x 2 checkKeyMarshal("android.control.aeTargetFpsRange", -- cgit v1.1