1a0842b40441db5332a5290f941021636b1182761Sol Boucher/* 2a0842b40441db5332a5290f941021636b1182761Sol Boucher * Copyright (C) 2014 The Android Open Source Project 3a0842b40441db5332a5290f941021636b1182761Sol Boucher * 4a0842b40441db5332a5290f941021636b1182761Sol Boucher * Licensed under the Apache License, Version 2.0 (the "License"); 5a0842b40441db5332a5290f941021636b1182761Sol Boucher * you may not use this file except in compliance with the License. 6a0842b40441db5332a5290f941021636b1182761Sol Boucher * You may obtain a copy of the License at 7a0842b40441db5332a5290f941021636b1182761Sol Boucher * 8a0842b40441db5332a5290f941021636b1182761Sol Boucher * http://www.apache.org/licenses/LICENSE-2.0 9a0842b40441db5332a5290f941021636b1182761Sol Boucher * 10a0842b40441db5332a5290f941021636b1182761Sol Boucher * Unless required by applicable law or agreed to in writing, software 11a0842b40441db5332a5290f941021636b1182761Sol Boucher * distributed under the License is distributed on an "AS IS" BASIS, 12a0842b40441db5332a5290f941021636b1182761Sol Boucher * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13a0842b40441db5332a5290f941021636b1182761Sol Boucher * See the License for the specific language governing permissions and 14a0842b40441db5332a5290f941021636b1182761Sol Boucher * limitations under the License. 15a0842b40441db5332a5290f941021636b1182761Sol Boucher */ 16a0842b40441db5332a5290f941021636b1182761Sol Boucher 178097973089420749dcd1ab4974a629c2466b31ccAngus Kongpackage com.android.ex.camera2.portability; 188097973089420749dcd1ab4974a629c2466b31ccAngus Kong 198097973089420749dcd1ab4974a629c2466b31ccAngus Kongimport android.hardware.Camera; 208097973089420749dcd1ab4974a629c2466b31ccAngus Kong 21de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucherimport com.android.ex.camera2.portability.debug.Log; 22de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher 238097973089420749dcd1ab4974a629c2466b31ccAngus Kongimport java.util.ArrayList; 248097973089420749dcd1ab4974a629c2466b31ccAngus Kongimport java.util.List; 258097973089420749dcd1ab4974a629c2466b31ccAngus Kongimport java.util.Map; 268097973089420749dcd1ab4974a629c2466b31ccAngus Kongimport java.util.TreeMap; 278097973089420749dcd1ab4974a629c2466b31ccAngus Kong 288097973089420749dcd1ab4974a629c2466b31ccAngus Kong/** 298097973089420749dcd1ab4974a629c2466b31ccAngus Kong * A class which stores the camera settings. 308097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 31de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucherpublic abstract class CameraSettings { 32de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher private static final Log.Tag TAG = new Log.Tag("CamSet"); 33de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher 34de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher // Attempts to provide a value outside this range will be ignored. 35de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher private static final int MIN_JPEG_COMPRESSION_QUALITY = 1; 36de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher private static final int MAX_JPEG_COMPRESSION_QUALITY = 100; 378097973089420749dcd1ab4974a629c2466b31ccAngus Kong 388097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected final Map<String, String> mGeneralSetting = new TreeMap<>(); 398097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected final List<Camera.Area> mMeteringAreas = new ArrayList<>(); 408097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected final List<Camera.Area> mFocusAreas = new ArrayList<>(); 412569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher protected boolean mSizesLocked; 428097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected int mPreviewFpsRangeMin; 438097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected int mPreviewFpsRangeMax; 448097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected int mPreviewFrameRate; 458097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected Size mCurrentPreviewSize; 4601e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong private int mCurrentPreviewFormat; 478097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected Size mCurrentPhotoSize; 48de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher protected byte mJpegCompressQuality; 4901e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong protected int mCurrentPhotoFormat; 508097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected float mCurrentZoomRatio; 518097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected int mExposureCompensationIndex; 528097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected CameraCapabilities.FlashMode mCurrentFlashMode; 538097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected CameraCapabilities.FocusMode mCurrentFocusMode; 548097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected CameraCapabilities.SceneMode mCurrentSceneMode; 558097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected CameraCapabilities.WhiteBalance mWhiteBalance; 568097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected boolean mVideoStabilizationEnabled; 578097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected boolean mAutoExposureLocked; 588097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected boolean mAutoWhiteBalanceLocked; 5901e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong protected boolean mRecordingHintEnabled; 608097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected GpsData mGpsData; 611c1d1afb5701b78fcdf09969bba1c20eb591bccfAlan Newberger protected Size mExifThumbnailSize; 628097973089420749dcd1ab4974a629c2466b31ccAngus Kong 638097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 648097973089420749dcd1ab4974a629c2466b31ccAngus Kong * An immutable class storing GPS related information. 658097973089420749dcd1ab4974a629c2466b31ccAngus Kong * <p>It's a hack since we always use GPS time stamp but does not use other 668097973089420749dcd1ab4974a629c2466b31ccAngus Kong * fields sometimes. Setting processing method to null means the other 678097973089420749dcd1ab4974a629c2466b31ccAngus Kong * fields should not be used.</p> 688097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 698097973089420749dcd1ab4974a629c2466b31ccAngus Kong public static class GpsData { 708097973089420749dcd1ab4974a629c2466b31ccAngus Kong public final double latitude; 718097973089420749dcd1ab4974a629c2466b31ccAngus Kong public final double longitude; 728097973089420749dcd1ab4974a629c2466b31ccAngus Kong public final double altitude; 738097973089420749dcd1ab4974a629c2466b31ccAngus Kong public final long timeStamp; 748097973089420749dcd1ab4974a629c2466b31ccAngus Kong public final String processingMethod; 758097973089420749dcd1ab4974a629c2466b31ccAngus Kong 76d0185cc2f5786571565f01b26e1143ce0099bdc8Sol Boucher /** 77d0185cc2f5786571565f01b26e1143ce0099bdc8Sol Boucher * Construct what may or may not actually represent a location, 78d0185cc2f5786571565f01b26e1143ce0099bdc8Sol Boucher * depending on the value of {@code processingMethod}. 79d0185cc2f5786571565f01b26e1143ce0099bdc8Sol Boucher * 80d0185cc2f5786571565f01b26e1143ce0099bdc8Sol Boucher * <p>Setting {@code processingMethod} to {@code null} means that 81d0185cc2f5786571565f01b26e1143ce0099bdc8Sol Boucher * {@code latitude}, {@code longitude}, and {@code altitude} will be 82d0185cc2f5786571565f01b26e1143ce0099bdc8Sol Boucher * completely ignored.</p> 83d0185cc2f5786571565f01b26e1143ce0099bdc8Sol Boucher */ 848097973089420749dcd1ab4974a629c2466b31ccAngus Kong public GpsData(double latitude, double longitude, double altitude, long timeStamp, 858097973089420749dcd1ab4974a629c2466b31ccAngus Kong String processingMethod) { 86d0185cc2f5786571565f01b26e1143ce0099bdc8Sol Boucher if (processingMethod == null && 87d0185cc2f5786571565f01b26e1143ce0099bdc8Sol Boucher (latitude != 0.0 || longitude != 0.0 || altitude != 0.0)) { 88d0185cc2f5786571565f01b26e1143ce0099bdc8Sol Boucher Log.w(TAG, "GpsData's nonzero data will be ignored due to null processingMethod"); 89d0185cc2f5786571565f01b26e1143ce0099bdc8Sol Boucher } 908097973089420749dcd1ab4974a629c2466b31ccAngus Kong this.latitude = latitude; 918097973089420749dcd1ab4974a629c2466b31ccAngus Kong this.longitude = longitude; 928097973089420749dcd1ab4974a629c2466b31ccAngus Kong this.altitude = altitude; 938097973089420749dcd1ab4974a629c2466b31ccAngus Kong this.timeStamp = timeStamp; 948097973089420749dcd1ab4974a629c2466b31ccAngus Kong this.processingMethod = processingMethod; 958097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 968097973089420749dcd1ab4974a629c2466b31ccAngus Kong 978097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** Copy constructor. */ 988097973089420749dcd1ab4974a629c2466b31ccAngus Kong public GpsData(GpsData src) { 998097973089420749dcd1ab4974a629c2466b31ccAngus Kong this.latitude = src.latitude; 1008097973089420749dcd1ab4974a629c2466b31ccAngus Kong this.longitude = src.longitude; 1018097973089420749dcd1ab4974a629c2466b31ccAngus Kong this.altitude = src.altitude; 1028097973089420749dcd1ab4974a629c2466b31ccAngus Kong this.timeStamp = src.timeStamp; 1038097973089420749dcd1ab4974a629c2466b31ccAngus Kong this.processingMethod = src.processingMethod; 1048097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 1058097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 1068097973089420749dcd1ab4974a629c2466b31ccAngus Kong 1078097973089420749dcd1ab4974a629c2466b31ccAngus Kong protected CameraSettings() { 1088097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 1098097973089420749dcd1ab4974a629c2466b31ccAngus Kong 1108097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 1118097973089420749dcd1ab4974a629c2466b31ccAngus Kong * Copy constructor. 1128097973089420749dcd1ab4974a629c2466b31ccAngus Kong * 1138097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @param src The source settings. 1148097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @return The copy of the source. 1158097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 116de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher protected CameraSettings(CameraSettings src) { 1178097973089420749dcd1ab4974a629c2466b31ccAngus Kong mGeneralSetting.putAll(src.mGeneralSetting); 1188097973089420749dcd1ab4974a629c2466b31ccAngus Kong mMeteringAreas.addAll(src.mMeteringAreas); 1198097973089420749dcd1ab4974a629c2466b31ccAngus Kong mFocusAreas.addAll(src.mFocusAreas); 1202569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher mSizesLocked = src.mSizesLocked; 1218097973089420749dcd1ab4974a629c2466b31ccAngus Kong mPreviewFpsRangeMin = src.mPreviewFpsRangeMin; 1228097973089420749dcd1ab4974a629c2466b31ccAngus Kong mPreviewFpsRangeMax = src.mPreviewFpsRangeMax; 1238097973089420749dcd1ab4974a629c2466b31ccAngus Kong mPreviewFrameRate = src.mPreviewFrameRate; 1248097973089420749dcd1ab4974a629c2466b31ccAngus Kong mCurrentPreviewSize = 1258097973089420749dcd1ab4974a629c2466b31ccAngus Kong (src.mCurrentPreviewSize == null ? null : new Size(src.mCurrentPreviewSize)); 12601e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong mCurrentPreviewFormat = src.mCurrentPreviewFormat; 1278097973089420749dcd1ab4974a629c2466b31ccAngus Kong mCurrentPhotoSize = 1288097973089420749dcd1ab4974a629c2466b31ccAngus Kong (src.mCurrentPhotoSize == null ? null : new Size(src.mCurrentPhotoSize)); 1298097973089420749dcd1ab4974a629c2466b31ccAngus Kong mJpegCompressQuality = src.mJpegCompressQuality; 13001e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong mCurrentPhotoFormat = src.mCurrentPhotoFormat; 1318097973089420749dcd1ab4974a629c2466b31ccAngus Kong mCurrentZoomRatio = src.mCurrentZoomRatio; 1328097973089420749dcd1ab4974a629c2466b31ccAngus Kong mExposureCompensationIndex = src.mExposureCompensationIndex; 1338097973089420749dcd1ab4974a629c2466b31ccAngus Kong mCurrentFlashMode = src.mCurrentFlashMode; 1348097973089420749dcd1ab4974a629c2466b31ccAngus Kong mCurrentFocusMode = src.mCurrentFocusMode; 1358097973089420749dcd1ab4974a629c2466b31ccAngus Kong mCurrentSceneMode = src.mCurrentSceneMode; 1368097973089420749dcd1ab4974a629c2466b31ccAngus Kong mWhiteBalance = src.mWhiteBalance; 1378097973089420749dcd1ab4974a629c2466b31ccAngus Kong mVideoStabilizationEnabled = src.mVideoStabilizationEnabled; 1388097973089420749dcd1ab4974a629c2466b31ccAngus Kong mAutoExposureLocked = src.mAutoExposureLocked; 1398097973089420749dcd1ab4974a629c2466b31ccAngus Kong mAutoWhiteBalanceLocked = src.mAutoWhiteBalanceLocked; 14001e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong mRecordingHintEnabled = src.mRecordingHintEnabled; 1418097973089420749dcd1ab4974a629c2466b31ccAngus Kong mGpsData = src.mGpsData; 14201e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong mExifThumbnailSize = src.mExifThumbnailSize; 1438097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 1448097973089420749dcd1ab4974a629c2466b31ccAngus Kong 145de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher /** 146de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher * @return A copy of this object, as an instance of the implementing class. 147de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher */ 148de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher public abstract CameraSettings copy(); 149de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher 1508097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** General setting **/ 1518097973089420749dcd1ab4974a629c2466b31ccAngus Kong @Deprecated 1528097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setSetting(String key, String value) { 1538097973089420749dcd1ab4974a629c2466b31ccAngus Kong mGeneralSetting.put(key, value); 1548097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 1558097973089420749dcd1ab4974a629c2466b31ccAngus Kong 1562569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher /** 1572569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher * Changes whether classes outside this class are allowed to set the preview 1582569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher * and photo capture sizes. 1592569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher * 1602569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher * @param locked Whether to prevent changes to these fields. 1612569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher * 1622569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher * @see #setPhotoSize 1632569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher * @see #setPreviewSize 1642569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher */ 1652569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher /*package*/ void setSizesLocked(boolean locked) { 1662569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher mSizesLocked = locked; 1672569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher } 1682569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher 1698097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** Preview **/ 1708097973089420749dcd1ab4974a629c2466b31ccAngus Kong 1718097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 1728097973089420749dcd1ab4974a629c2466b31ccAngus Kong * Sets the preview FPS range. This call will invalidate prior calls to 1738097973089420749dcd1ab4974a629c2466b31ccAngus Kong * {@link #setPreviewFrameRate(int)}. 1748097973089420749dcd1ab4974a629c2466b31ccAngus Kong * 1758097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @param min The min FPS. 1768097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @param max The max FPS. 1778097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 1788097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setPreviewFpsRange(int min, int max) { 1798097973089420749dcd1ab4974a629c2466b31ccAngus Kong if (min > max) { 1808097973089420749dcd1ab4974a629c2466b31ccAngus Kong int temp = max; 1818097973089420749dcd1ab4974a629c2466b31ccAngus Kong max = min; 1828097973089420749dcd1ab4974a629c2466b31ccAngus Kong min = temp; 1838097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 1848097973089420749dcd1ab4974a629c2466b31ccAngus Kong mPreviewFpsRangeMax = max; 1858097973089420749dcd1ab4974a629c2466b31ccAngus Kong mPreviewFpsRangeMin = min; 1868097973089420749dcd1ab4974a629c2466b31ccAngus Kong mPreviewFrameRate = -1; 1878097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 1888097973089420749dcd1ab4974a629c2466b31ccAngus Kong 1898097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 1908097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @return The min of the preview FPS range. 1918097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 1928097973089420749dcd1ab4974a629c2466b31ccAngus Kong public int getPreviewFpsRangeMin() { 1938097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mPreviewFpsRangeMin; 1948097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 1958097973089420749dcd1ab4974a629c2466b31ccAngus Kong 1968097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 1978097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @return The max of the preview FPS range. 1988097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 1998097973089420749dcd1ab4974a629c2466b31ccAngus Kong public int getPreviewFpsRangeMax() { 2008097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mPreviewFpsRangeMax; 2018097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 2028097973089420749dcd1ab4974a629c2466b31ccAngus Kong 2038097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 2048097973089420749dcd1ab4974a629c2466b31ccAngus Kong * Sets the preview FPS. This call will invalidate prior calls to 2058097973089420749dcd1ab4974a629c2466b31ccAngus Kong * {@link #setPreviewFpsRange(int, int)}. 2068097973089420749dcd1ab4974a629c2466b31ccAngus Kong * 2078097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @param frameRate The target frame rate. 2088097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 2098097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setPreviewFrameRate(int frameRate) { 2108097973089420749dcd1ab4974a629c2466b31ccAngus Kong if (frameRate > 0) { 2118097973089420749dcd1ab4974a629c2466b31ccAngus Kong mPreviewFrameRate = frameRate; 2128097973089420749dcd1ab4974a629c2466b31ccAngus Kong mPreviewFpsRangeMax = frameRate; 2138097973089420749dcd1ab4974a629c2466b31ccAngus Kong mPreviewFpsRangeMin = frameRate; 2148097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 2158097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 2168097973089420749dcd1ab4974a629c2466b31ccAngus Kong 2178097973089420749dcd1ab4974a629c2466b31ccAngus Kong public int getPreviewFrameRate() { 2188097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mPreviewFrameRate; 2198097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 2208097973089420749dcd1ab4974a629c2466b31ccAngus Kong 2218097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 2228097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @return The current preview size. 2238097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 2248097973089420749dcd1ab4974a629c2466b31ccAngus Kong public Size getCurrentPreviewSize() { 2258097973089420749dcd1ab4974a629c2466b31ccAngus Kong return new Size(mCurrentPreviewSize); 2268097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 2278097973089420749dcd1ab4974a629c2466b31ccAngus Kong 2288097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 2298097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @param previewSize The size to use for preview. 2302569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher * @return Whether the operation was allowed (i.e. the sizes are unlocked). 2318097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 2322569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher public boolean setPreviewSize(Size previewSize) { 2332569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher if (mSizesLocked) { 2342569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher Log.w(TAG, "Attempt to change preview size while locked"); 2352569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher return false; 2362569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher } 2372569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher 2388097973089420749dcd1ab4974a629c2466b31ccAngus Kong mCurrentPreviewSize = new Size(previewSize); 2392569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher return true; 2408097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 2418097973089420749dcd1ab4974a629c2466b31ccAngus Kong 24201e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong /** 24301e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * Sets the preview format. 24401e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * 24501e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * @param format 24601e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * @see {@link android.graphics.ImageFormat}. 24701e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong */ 24801e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong public void setPreviewFormat(int format) { 24901e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong mCurrentPreviewFormat = format; 25001e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong } 25101e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong 25201e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong /** 25301e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * @return The preview format. 25401e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * @see {@link android.graphics.ImageFormat}. 25501e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong */ 25601e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong public int getCurrentPreviewFormat() { 25701e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong return mCurrentPreviewFormat; 25801e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong } 25901e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong 2608097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** Picture **/ 2618097973089420749dcd1ab4974a629c2466b31ccAngus Kong 2628097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 2638097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @return The current photo size. 2648097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 2658097973089420749dcd1ab4974a629c2466b31ccAngus Kong public Size getCurrentPhotoSize() { 2668097973089420749dcd1ab4974a629c2466b31ccAngus Kong return new Size(mCurrentPhotoSize); 2678097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 2688097973089420749dcd1ab4974a629c2466b31ccAngus Kong 2698097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 2702569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher * @param photoSize The size to use for preview. 2712569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher * @return Whether the operation was allowed (i.e. the sizes are unlocked). 2728097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 2732569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher public boolean setPhotoSize(Size photoSize) { 2742569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher if (mSizesLocked) { 2752569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher Log.w(TAG, "Attempt to change photo size while locked"); 2762569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher return false; 2772569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher } 2782569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher 2798097973089420749dcd1ab4974a629c2466b31ccAngus Kong mCurrentPhotoSize = new Size(photoSize); 2802569329d6cff25bfe9941df539df14a0aeb4c4f4Sol Boucher return true; 2818097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 2828097973089420749dcd1ab4974a629c2466b31ccAngus Kong 2838097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 28401e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * Sets the format for the photo. 28501e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * 28601e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * @param format The format for the photos taken. 28701e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * @see {@link android.graphics.ImageFormat}. 28801e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong */ 28901e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong public void setPhotoFormat(int format) { 29001e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong mCurrentPhotoFormat = format; 29101e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong } 29201e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong 29301e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong /** 29401e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * @return The format for the photos taken. 29501e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * @see {@link android.graphics.ImageFormat}. 29601e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong */ 29701e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong public int getCurrentPhotoFormat() { 29801e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong return mCurrentPhotoFormat; 29901e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong } 30001e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong 30101e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong /** 3028097973089420749dcd1ab4974a629c2466b31ccAngus Kong * Sets the JPEG compression quality. 3038097973089420749dcd1ab4974a629c2466b31ccAngus Kong * 3048097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @param quality The quality for JPEG. 3058097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 3068097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setPhotoJpegCompressionQuality(int quality) { 307de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher if (quality < MIN_JPEG_COMPRESSION_QUALITY || quality > MAX_JPEG_COMPRESSION_QUALITY) { 308de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher Log.w(TAG, "Ignoring JPEG quality that falls outside the expected range"); 309de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher return; 310de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher } 311de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher // This is safe because the positive numbers go up to 127. 312de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher mJpegCompressQuality = (byte) quality; 3138097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3148097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3158097973089420749dcd1ab4974a629c2466b31ccAngus Kong public int getPhotoJpegCompressionQuality() { 3168097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mJpegCompressQuality; 3178097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3188097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3198097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** Zoom **/ 3208097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3218097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 3228097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @return The current zoom ratio. The min is 1.0f. 3238097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 3248097973089420749dcd1ab4974a629c2466b31ccAngus Kong public float getCurrentZoomRatio() { 3258097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mCurrentZoomRatio; 3268097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3278097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3288097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 3298097973089420749dcd1ab4974a629c2466b31ccAngus Kong * Sets the zoom ratio. 3308097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @param ratio The new zoom ratio. Should be in the range between 1.0 to 3318097973089420749dcd1ab4974a629c2466b31ccAngus Kong * the value returned from {@link 3328097973089420749dcd1ab4974a629c2466b31ccAngus Kong * com.android.camera.cameradevice.CameraCapabilities#getMaxZoomRatio()}. 3338097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @throws java.lang.UnsupportedOperationException if the ratio is not 3348097973089420749dcd1ab4974a629c2466b31ccAngus Kong * supported. 3358097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 3368097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setZoomRatio(float ratio) { 3378097973089420749dcd1ab4974a629c2466b31ccAngus Kong mCurrentZoomRatio = ratio; 3388097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3398097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3408097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** Exposure **/ 3418097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3428097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setExposureCompensationIndex(int index) { 3438097973089420749dcd1ab4974a629c2466b31ccAngus Kong mExposureCompensationIndex = index; 3448097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3458097973089420749dcd1ab4974a629c2466b31ccAngus Kong 346de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher /** 347de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher * @return The exposure compensation, with 0 meaning unadjusted. 348de48004068f8c16f9a56c60b0ed2485a67687b4bSol Boucher */ 3498097973089420749dcd1ab4974a629c2466b31ccAngus Kong public int getExposureCompensationIndex() { 3508097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mExposureCompensationIndex; 3518097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3528097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3538097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setAutoExposureLock(boolean locked) { 3548097973089420749dcd1ab4974a629c2466b31ccAngus Kong mAutoExposureLocked = locked; 3558097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3568097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3578097973089420749dcd1ab4974a629c2466b31ccAngus Kong public boolean isAutoExposureLocked() { 3588097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mAutoExposureLocked; 3598097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3608097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3619d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher /** 3629d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher * @param areas The areas for autoexposure. The coordinate system has domain 3639d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher * and range [-1000,1000], measured relative to the visible 3649d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher * preview image, with orientation matching that of the sensor. 3659d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher * This means the coordinates must be transformed to account 3669d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher * for the devices rotation---but not the zoom level---before 3679d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher * being passed into this method. 3689d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher */ 3698097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setMeteringAreas(List<Camera.Area> areas) { 3708097973089420749dcd1ab4974a629c2466b31ccAngus Kong mMeteringAreas.clear(); 3718097973089420749dcd1ab4974a629c2466b31ccAngus Kong if (areas != null) { 3728097973089420749dcd1ab4974a629c2466b31ccAngus Kong mMeteringAreas.addAll(areas); 3738097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3748097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3758097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3768097973089420749dcd1ab4974a629c2466b31ccAngus Kong public List<Camera.Area> getMeteringAreas() { 3778097973089420749dcd1ab4974a629c2466b31ccAngus Kong return new ArrayList<Camera.Area>(mMeteringAreas); 3788097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3798097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3808097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** Flash **/ 3818097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3828097973089420749dcd1ab4974a629c2466b31ccAngus Kong public CameraCapabilities.FlashMode getCurrentFlashMode() { 3838097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mCurrentFlashMode; 3848097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3858097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3868097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setFlashMode(CameraCapabilities.FlashMode flashMode) { 3878097973089420749dcd1ab4974a629c2466b31ccAngus Kong mCurrentFlashMode = flashMode; 3888097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3898097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3908097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** Focus **/ 3918097973089420749dcd1ab4974a629c2466b31ccAngus Kong 3928097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 3938097973089420749dcd1ab4974a629c2466b31ccAngus Kong * Sets the focus mode. 3948097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @param focusMode The focus mode to use. 3958097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 3968097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setFocusMode(CameraCapabilities.FocusMode focusMode) { 3978097973089420749dcd1ab4974a629c2466b31ccAngus Kong mCurrentFocusMode = focusMode; 3988097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 3998097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4008097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 4018097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @return The current focus mode. 4028097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 4038097973089420749dcd1ab4974a629c2466b31ccAngus Kong public CameraCapabilities.FocusMode getCurrentFocusMode() { 4048097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mCurrentFocusMode; 4058097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4068097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4078097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 4089d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher * @param areas The areas to focus. The coordinate system has domain and 4099d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher * range [-1000,1000], measured relative to the visible preview 4109d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher * image, with orientation matching that of the sensor. This 4119d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher * means the coordinates must be transformed to account for 4129d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher * the devices rotation---but not the zoom level---before being 4139d8668449376fa47bc6528c7a61b04d6a0f691b3Sol Boucher * passed into this method. 4148097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 4158097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setFocusAreas(List<Camera.Area> areas) { 4168097973089420749dcd1ab4974a629c2466b31ccAngus Kong mFocusAreas.clear(); 4178097973089420749dcd1ab4974a629c2466b31ccAngus Kong if (areas != null) { 4188097973089420749dcd1ab4974a629c2466b31ccAngus Kong mFocusAreas.addAll(areas); 4198097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4208097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4218097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4228097973089420749dcd1ab4974a629c2466b31ccAngus Kong public List<Camera.Area> getFocusAreas() { 4238097973089420749dcd1ab4974a629c2466b31ccAngus Kong return new ArrayList<Camera.Area>(mFocusAreas); 4248097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4258097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4268097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** White balance **/ 4278097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4288097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setWhiteBalance(CameraCapabilities.WhiteBalance whiteBalance) { 4298097973089420749dcd1ab4974a629c2466b31ccAngus Kong mWhiteBalance = whiteBalance; 4308097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4318097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4328097973089420749dcd1ab4974a629c2466b31ccAngus Kong public CameraCapabilities.WhiteBalance getWhiteBalance() { 4338097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mWhiteBalance; 4348097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4358097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4368097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setAutoWhiteBalanceLock(boolean locked) { 4378097973089420749dcd1ab4974a629c2466b31ccAngus Kong mAutoWhiteBalanceLocked = locked; 4388097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4398097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4408097973089420749dcd1ab4974a629c2466b31ccAngus Kong public boolean isAutoWhiteBalanceLocked() { 4418097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mAutoWhiteBalanceLocked; 4428097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4438097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4448097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** Scene mode **/ 4458097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4468097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 4478097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @return The current scene mode. 4488097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 4498097973089420749dcd1ab4974a629c2466b31ccAngus Kong public CameraCapabilities.SceneMode getCurrentSceneMode() { 4508097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mCurrentSceneMode; 4518097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4528097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4538097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** 4548097973089420749dcd1ab4974a629c2466b31ccAngus Kong * Sets the scene mode for capturing. 4558097973089420749dcd1ab4974a629c2466b31ccAngus Kong * 4568097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @param sceneMode The scene mode to use. 4578097973089420749dcd1ab4974a629c2466b31ccAngus Kong * @throws java.lang.UnsupportedOperationException if it's not supported. 4588097973089420749dcd1ab4974a629c2466b31ccAngus Kong */ 4598097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setSceneMode(CameraCapabilities.SceneMode sceneMode) { 4608097973089420749dcd1ab4974a629c2466b31ccAngus Kong mCurrentSceneMode = sceneMode; 4618097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4628097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4638097973089420749dcd1ab4974a629c2466b31ccAngus Kong /** Other Features **/ 4648097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4658097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setVideoStabilization(boolean enabled) { 4668097973089420749dcd1ab4974a629c2466b31ccAngus Kong mVideoStabilizationEnabled = enabled; 4678097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4688097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4698097973089420749dcd1ab4974a629c2466b31ccAngus Kong public boolean isVideoStabilizationEnabled() { 4708097973089420749dcd1ab4974a629c2466b31ccAngus Kong return mVideoStabilizationEnabled; 4718097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4728097973089420749dcd1ab4974a629c2466b31ccAngus Kong 47301e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong public void setRecordingHintEnabled(boolean hintEnabled) { 47401e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong mRecordingHintEnabled = hintEnabled; 47501e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong } 47601e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong 47701e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong public boolean isRecordingHintEnabled() { 47801e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong return mRecordingHintEnabled; 47901e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong } 48001e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong 4818097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void setGpsData(GpsData data) { 4828097973089420749dcd1ab4974a629c2466b31ccAngus Kong mGpsData = new GpsData(data); 4838097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4848097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4858097973089420749dcd1ab4974a629c2466b31ccAngus Kong public GpsData getGpsData() { 4868097973089420749dcd1ab4974a629c2466b31ccAngus Kong return (mGpsData == null ? null : new GpsData(mGpsData)); 4878097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 4888097973089420749dcd1ab4974a629c2466b31ccAngus Kong 4898097973089420749dcd1ab4974a629c2466b31ccAngus Kong public void clearGpsData() { 4908097973089420749dcd1ab4974a629c2466b31ccAngus Kong mGpsData = null; 4918097973089420749dcd1ab4974a629c2466b31ccAngus Kong } 49201e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong 49301e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong /** 4941c1d1afb5701b78fcdf09969bba1c20eb591bccfAlan Newberger * Sets the size of the thumbnail in EXIF header. To suppress thumbnail 4951c1d1afb5701b78fcdf09969bba1c20eb591bccfAlan Newberger * generation, set a size of (0,0). 49601e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong * 4971c1d1afb5701b78fcdf09969bba1c20eb591bccfAlan Newberger * @param s The size for the thumbnail. If {@code null}, agent will not 4981c1d1afb5701b78fcdf09969bba1c20eb591bccfAlan Newberger * set a thumbnail size. 49901e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong */ 50001e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong public void setExifThumbnailSize(Size s) { 5011c1d1afb5701b78fcdf09969bba1c20eb591bccfAlan Newberger mExifThumbnailSize = s; 50201e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong } 50301e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong 5041c1d1afb5701b78fcdf09969bba1c20eb591bccfAlan Newberger /** 5051c1d1afb5701b78fcdf09969bba1c20eb591bccfAlan Newberger * Gets the size of the thumbnail in EXIF header. 5061c1d1afb5701b78fcdf09969bba1c20eb591bccfAlan Newberger * 5071c1d1afb5701b78fcdf09969bba1c20eb591bccfAlan Newberger * @return desired thumbnail size, or null if no size was set 5081c1d1afb5701b78fcdf09969bba1c20eb591bccfAlan Newberger */ 50901e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong public Size getExifThumbnailSize() { 5101c1d1afb5701b78fcdf09969bba1c20eb591bccfAlan Newberger return (mExifThumbnailSize == null) ? null : new Size(mExifThumbnailSize); 51101e7c02174ef268b6d6daaa5a5bb4f752d55964cAngus Kong } 5128097973089420749dcd1ab4974a629c2466b31ccAngus Kong} 513