diff options
author | Igor Murashkin <iam@google.com> | 2014-05-30 10:49:00 -0700 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2014-05-30 11:28:49 -0700 |
commit | 5743868e15c88d2886915163652a1571a218bf39 (patch) | |
tree | 96027c1ee45d748b7df92b55ae9d133dd8be32f5 /media | |
parent | 2d2e30eeac5b6799808c23b944f29d68ed0c205d (diff) | |
download | frameworks_base-5743868e15c88d2886915163652a1571a218bf39.zip frameworks_base-5743868e15c88d2886915163652a1571a218bf39.tar.gz frameworks_base-5743868e15c88d2886915163652a1571a218bf39.tar.bz2 |
camera2: Change android.lens.focusRange to Pair<Float,Float>
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
Diffstat (limited to 'media')
-rw-r--r-- | media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java | 17 |
1 files changed, 17 insertions, 0 deletions
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<Float, Float>>() {{ }}, + 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<Byte, Integer>>() {{ }}, + Pair.create((byte)123, 22), + toByteArray((byte)123, (byte)22)); + } + + @SmallTest public void testReadWriteRange() { // int32 x 2 checkKeyMarshal("android.control.aeTargetFpsRange", |