summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/callcomposer/camera/exif
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/dialer/callcomposer/camera/exif')
-rw-r--r--java/com/android/dialer/callcomposer/camera/exif/CountedDataInputStream.java34
-rw-r--r--java/com/android/dialer/callcomposer/camera/exif/ExifData.java12
-rw-r--r--java/com/android/dialer/callcomposer/camera/exif/ExifInterface.java48
-rw-r--r--java/com/android/dialer/callcomposer/camera/exif/ExifParser.java210
-rw-r--r--java/com/android/dialer/callcomposer/camera/exif/ExifTag.java200
-rw-r--r--java/com/android/dialer/callcomposer/camera/exif/IfdData.java30
-rw-r--r--java/com/android/dialer/callcomposer/camera/exif/Rational.java18
7 files changed, 273 insertions, 279 deletions
diff --git a/java/com/android/dialer/callcomposer/camera/exif/CountedDataInputStream.java b/java/com/android/dialer/callcomposer/camera/exif/CountedDataInputStream.java
index e2c8185da..cb5143a92 100644
--- a/java/com/android/dialer/callcomposer/camera/exif/CountedDataInputStream.java
+++ b/java/com/android/dialer/callcomposer/camera/exif/CountedDataInputStream.java
@@ -27,45 +27,45 @@ import java.nio.charset.Charset;
class CountedDataInputStream extends FilterInputStream {
- private int mCount = 0;
+ private int count = 0;
// allocate a byte buffer for a long value;
- private final byte[] mByteArray = new byte[8];
- private final ByteBuffer mByteBuffer = ByteBuffer.wrap(mByteArray);
+ private final byte[] byteArray = new byte[8];
+ private final ByteBuffer byteBuffer = ByteBuffer.wrap(byteArray);
CountedDataInputStream(InputStream in) {
super(in);
}
int getReadByteCount() {
- return mCount;
+ return count;
}
@Override
public int read(byte[] b) throws IOException {
int r = in.read(b);
- mCount += (r >= 0) ? r : 0;
+ count += (r >= 0) ? r : 0;
return r;
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
int r = in.read(b, off, len);
- mCount += (r >= 0) ? r : 0;
+ count += (r >= 0) ? r : 0;
return r;
}
@Override
public int read() throws IOException {
int r = in.read();
- mCount += (r >= 0) ? 1 : 0;
+ count += (r >= 0) ? 1 : 0;
return r;
}
@Override
public long skip(long length) throws IOException {
long skip = in.skip(length);
- mCount += skip;
+ count += skip;
return skip;
}
@@ -76,7 +76,7 @@ class CountedDataInputStream extends FilterInputStream {
}
void skipTo(long target) throws IOException {
- long cur = mCount;
+ long cur = count;
long diff = target - cur;
Assert.checkArgument(diff >= 0);
skipOrThrow(diff);
@@ -94,17 +94,17 @@ class CountedDataInputStream extends FilterInputStream {
}
void setByteOrder(ByteOrder order) {
- mByteBuffer.order(order);
+ byteBuffer.order(order);
}
ByteOrder getByteOrder() {
- return mByteBuffer.order();
+ return byteBuffer.order();
}
short readShort() throws IOException {
- readOrThrow(mByteArray, 0, 2);
- mByteBuffer.rewind();
- return mByteBuffer.getShort();
+ readOrThrow(byteArray, 0, 2);
+ byteBuffer.rewind();
+ return byteBuffer.getShort();
}
int readUnsignedShort() throws IOException {
@@ -112,9 +112,9 @@ class CountedDataInputStream extends FilterInputStream {
}
int readInt() throws IOException {
- readOrThrow(mByteArray, 0, 4);
- mByteBuffer.rewind();
- return mByteBuffer.getInt();
+ readOrThrow(byteArray, 0, 4);
+ byteBuffer.rewind();
+ return byteBuffer.getInt();
}
long readUnsignedInt() throws IOException {
diff --git a/java/com/android/dialer/callcomposer/camera/exif/ExifData.java b/java/com/android/dialer/callcomposer/camera/exif/ExifData.java
index 27936ae2f..fef9d870c 100644
--- a/java/com/android/dialer/callcomposer/camera/exif/ExifData.java
+++ b/java/com/android/dialer/callcomposer/camera/exif/ExifData.java
@@ -25,20 +25,20 @@ package com.android.dialer.callcomposer.camera.exif;
*/
public class ExifData {
- private final IfdData[] mIfdDatas = new IfdData[IfdId.TYPE_IFD_COUNT];
+ private final IfdData[] ifdDatas = new IfdData[IfdId.TYPE_IFD_COUNT];
/**
* Adds IFD data. If IFD data of the same type already exists, it will be replaced by the new
* data.
*/
void addIfdData(IfdData data) {
- mIfdDatas[data.getId()] = data;
+ ifdDatas[data.getId()] = data;
}
/** Returns the {@link IfdData} object corresponding to a given IFD if it exists or null. */
IfdData getIfdData(int ifdId) {
if (ExifTag.isValidIfd(ifdId)) {
- return mIfdDatas[ifdId];
+ return ifdDatas[ifdId];
}
return null;
}
@@ -47,7 +47,7 @@ public class ExifData {
* Returns the tag with a given TID in the given IFD if the tag exists. Otherwise returns null.
*/
protected ExifTag getTag(short tag, int ifd) {
- IfdData ifdData = mIfdDatas[ifd];
+ IfdData ifdData = ifdDatas[ifd];
return (ifdData == null) ? null : ifdData.getTag(tag);
}
@@ -79,10 +79,10 @@ public class ExifData {
* Returns the {@link IfdData} object corresponding to a given IFD or generates one if none exist.
*/
private IfdData getOrCreateIfdData(int ifdId) {
- IfdData ifdData = mIfdDatas[ifdId];
+ IfdData ifdData = ifdDatas[ifdId];
if (ifdData == null) {
ifdData = new IfdData(ifdId);
- mIfdDatas[ifdId] = ifdData;
+ ifdDatas[ifdId] = ifdData;
}
return ifdData;
}
diff --git a/java/com/android/dialer/callcomposer/camera/exif/ExifInterface.java b/java/com/android/dialer/callcomposer/camera/exif/ExifInterface.java
index 1bf9519ad..737401f64 100644
--- a/java/com/android/dialer/callcomposer/camera/exif/ExifInterface.java
+++ b/java/com/android/dialer/callcomposer/camera/exif/ExifInterface.java
@@ -61,21 +61,21 @@ public class ExifInterface {
static final int TAG_INTEROPERABILITY_IFD = defineTag(IfdId.TYPE_IFD_EXIF, (short) 0xA005);
/** Tags that contain offset markers. These are included in the banned defines. */
- private static HashSet<Short> sOffsetTags = new HashSet<>();
+ private static HashSet<Short> offsetTags = new HashSet<>();
static {
- sOffsetTags.add(getTrueTagKey(TAG_GPS_IFD));
- sOffsetTags.add(getTrueTagKey(TAG_EXIF_IFD));
- sOffsetTags.add(getTrueTagKey(TAG_JPEG_INTERCHANGE_FORMAT));
- sOffsetTags.add(getTrueTagKey(TAG_INTEROPERABILITY_IFD));
- sOffsetTags.add(getTrueTagKey(TAG_STRIP_OFFSETS));
+ offsetTags.add(getTrueTagKey(TAG_GPS_IFD));
+ offsetTags.add(getTrueTagKey(TAG_EXIF_IFD));
+ offsetTags.add(getTrueTagKey(TAG_JPEG_INTERCHANGE_FORMAT));
+ offsetTags.add(getTrueTagKey(TAG_INTEROPERABILITY_IFD));
+ offsetTags.add(getTrueTagKey(TAG_STRIP_OFFSETS));
}
private static final String NULL_ARGUMENT_STRING = "Argument is null";
private static final String GPS_DATE_FORMAT_STR = "yyyy:MM:dd";
- private ExifData mData = new ExifData();
+ private ExifData data = new ExifData();
@SuppressLint("SimpleDateFormat")
public ExifInterface() {
@@ -110,7 +110,7 @@ public class ExifInterface {
} catch (ExifInvalidFormatException e) {
throw new IOException("Invalid exif format : " + e);
}
- mData = d;
+ data = d;
}
/** Returns the TID for a tag constant. */
@@ -151,17 +151,17 @@ public class ExifInterface {
* @return true if the TID is that of an offset tag.
*/
static boolean isOffsetTag(short tag) {
- return sOffsetTags.contains(tag);
+ return offsetTags.contains(tag);
}
- private SparseIntArray mTagInfo = null;
+ private SparseIntArray tagInfo = null;
SparseIntArray getTagInfo() {
- if (mTagInfo == null) {
- mTagInfo = new SparseIntArray();
+ if (tagInfo == null) {
+ tagInfo = new SparseIntArray();
initTagInfo();
}
- return mTagInfo;
+ return tagInfo;
}
private void initTagInfo() {
@@ -173,24 +173,24 @@ public class ExifInterface {
// IFD0 tags
int[] ifdAllowedIfds = {IfdId.TYPE_IFD_0, IfdId.TYPE_IFD_1};
int ifdFlags = getFlagsFromAllowedIfds(ifdAllowedIfds) << 24;
- mTagInfo.put(ExifInterface.TAG_STRIP_OFFSETS, ifdFlags | ExifTag.TYPE_UNSIGNED_LONG << 16);
- mTagInfo.put(ExifInterface.TAG_EXIF_IFD, ifdFlags | ExifTag.TYPE_UNSIGNED_LONG << 16 | 1);
- mTagInfo.put(ExifInterface.TAG_GPS_IFD, ifdFlags | ExifTag.TYPE_UNSIGNED_LONG << 16 | 1);
- mTagInfo.put(ExifInterface.TAG_ORIENTATION, ifdFlags | ExifTag.TYPE_UNSIGNED_SHORT << 16 | 1);
- mTagInfo.put(ExifInterface.TAG_STRIP_BYTE_COUNTS, ifdFlags | ExifTag.TYPE_UNSIGNED_LONG << 16);
+ tagInfo.put(ExifInterface.TAG_STRIP_OFFSETS, ifdFlags | ExifTag.TYPE_UNSIGNED_LONG << 16);
+ tagInfo.put(ExifInterface.TAG_EXIF_IFD, ifdFlags | ExifTag.TYPE_UNSIGNED_LONG << 16 | 1);
+ tagInfo.put(ExifInterface.TAG_GPS_IFD, ifdFlags | ExifTag.TYPE_UNSIGNED_LONG << 16 | 1);
+ tagInfo.put(ExifInterface.TAG_ORIENTATION, ifdFlags | ExifTag.TYPE_UNSIGNED_SHORT << 16 | 1);
+ tagInfo.put(ExifInterface.TAG_STRIP_BYTE_COUNTS, ifdFlags | ExifTag.TYPE_UNSIGNED_LONG << 16);
// IFD1 tags
int[] ifd1AllowedIfds = {IfdId.TYPE_IFD_1};
int ifdFlags1 = getFlagsFromAllowedIfds(ifd1AllowedIfds) << 24;
- mTagInfo.put(
+ tagInfo.put(
ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT,
ifdFlags1 | ExifTag.TYPE_UNSIGNED_LONG << 16 | 1);
- mTagInfo.put(
+ tagInfo.put(
ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT_LENGTH,
ifdFlags1 | ExifTag.TYPE_UNSIGNED_LONG << 16 | 1);
// Exif tags
int[] exifAllowedIfds = {IfdId.TYPE_IFD_EXIF};
int exifFlags = getFlagsFromAllowedIfds(exifAllowedIfds) << 24;
- mTagInfo.put(
+ tagInfo.put(
ExifInterface.TAG_INTEROPERABILITY_IFD, exifFlags | ExifTag.TYPE_UNSIGNED_LONG << 16 | 1);
}
@@ -232,7 +232,7 @@ public class ExifInterface {
if (!ExifTag.isValidIfd(ifdId)) {
return null;
}
- return mData.getTag(getTrueTagKey(tagId), ifdId);
+ return data.getTag(getTrueTagKey(tagId), ifdId);
}
public Integer getTagIntValue(int tagId) {
@@ -328,7 +328,7 @@ public class ExifInterface {
/** Clears this ExifInterface object's existing exif tags. */
public void clearExif() {
- mData = new ExifData();
+ data = new ExifData();
}
/**
@@ -340,7 +340,7 @@ public class ExifInterface {
* @return the previous ExifTag with the same TID and IFD or null if none exists.
*/
public ExifTag setTag(ExifTag tag) {
- return mData.addTag(tag);
+ return data.addTag(tag);
}
/**
diff --git a/java/com/android/dialer/callcomposer/camera/exif/ExifParser.java b/java/com/android/dialer/callcomposer/camera/exif/ExifParser.java
index c728845a1..1aec4ab12 100644
--- a/java/com/android/dialer/callcomposer/camera/exif/ExifParser.java
+++ b/java/com/android/dialer/callcomposer/camera/exif/ExifParser.java
@@ -119,20 +119,20 @@ public class ExifParser {
private static final int DEFAULT_IFD0_OFFSET = 8;
- private final CountedDataInputStream mTiffStream;
- private final int mOptions;
- private int mIfdStartOffset = 0;
- private int mNumOfTagInIfd = 0;
- private int mIfdType;
- private ExifTag mTag;
- private ImageEvent mImageEvent;
- private ExifTag mStripSizeTag;
- private ExifTag mJpegSizeTag;
- private boolean mNeedToParseOffsetsInCurrentIfd;
- private boolean mContainExifData = false;
- private int mApp1End;
- private byte[] mDataAboveIfd0;
- private int mIfd0Position;
+ private final CountedDataInputStream tiffStream;
+ private final int options;
+ private int ifdStartOffset = 0;
+ private int numOfTagInIfd = 0;
+ private int ifdType;
+ private ExifTag tag;
+ private ImageEvent imageEvent;
+ private ExifTag stripSizeTag;
+ private ExifTag jpegSizeTag;
+ private boolean needToParseOffsetsInCurrentIfd;
+ private boolean containExifData = false;
+ private int app1End;
+ private byte[] dataAboveIfd0;
+ private int ifd0Position;
private final ExifInterface mInterface;
private static final short TAG_EXIF_IFD = ExifInterface.getTrueTagKey(ExifInterface.TAG_EXIF_IFD);
@@ -148,26 +148,26 @@ public class ExifParser {
private static final short TAG_STRIP_BYTE_COUNTS =
ExifInterface.getTrueTagKey(ExifInterface.TAG_STRIP_BYTE_COUNTS);
- private final TreeMap<Integer, Object> mCorrespondingEvent = new TreeMap<>();
+ private final TreeMap<Integer, Object> correspondingEvent = new TreeMap<>();
private boolean isIfdRequested(int ifdType) {
switch (ifdType) {
case IfdId.TYPE_IFD_0:
- return (mOptions & OPTION_IFD_0) != 0;
+ return (options & OPTION_IFD_0) != 0;
case IfdId.TYPE_IFD_1:
- return (mOptions & OPTION_IFD_1) != 0;
+ return (options & OPTION_IFD_1) != 0;
case IfdId.TYPE_IFD_EXIF:
- return (mOptions & OPTION_IFD_EXIF) != 0;
+ return (options & OPTION_IFD_EXIF) != 0;
case IfdId.TYPE_IFD_GPS:
- return (mOptions & OPTION_IFD_GPS) != 0;
+ return (options & OPTION_IFD_GPS) != 0;
case IfdId.TYPE_IFD_INTEROPERABILITY:
- return (mOptions & OPTION_IFD_INTEROPERABILITY) != 0;
+ return (options & OPTION_IFD_INTEROPERABILITY) != 0;
}
return false;
}
private boolean isThumbnailRequested() {
- return (mOptions & OPTION_THUMBNAIL) != 0;
+ return (options & OPTION_THUMBNAIL) != 0;
}
private ExifParser(InputStream inputStream, int options, ExifInterface iRef)
@@ -179,25 +179,25 @@ public class ExifParser {
LogUtil.v("ExifParser.ExifParser", "Reading exif...");
}
mInterface = iRef;
- mContainExifData = seekTiffData(inputStream);
- mTiffStream = new CountedDataInputStream(inputStream);
- mOptions = options;
- if (!mContainExifData) {
+ containExifData = seekTiffData(inputStream);
+ tiffStream = new CountedDataInputStream(inputStream);
+ this.options = options;
+ if (!containExifData) {
return;
}
parseTiffHeader();
- long offset = mTiffStream.readUnsignedInt();
+ long offset = tiffStream.readUnsignedInt();
if (offset > Integer.MAX_VALUE) {
throw new ExifInvalidFormatException("Invalid offset " + offset);
}
- mIfd0Position = (int) offset;
- mIfdType = IfdId.TYPE_IFD_0;
+ ifd0Position = (int) offset;
+ ifdType = IfdId.TYPE_IFD_0;
if (isIfdRequested(IfdId.TYPE_IFD_0) || needToParseOffsetsInCurrentIfd()) {
registerIfd(IfdId.TYPE_IFD_0, offset);
if (offset != DEFAULT_IFD0_OFFSET) {
- mDataAboveIfd0 = new byte[(int) offset - DEFAULT_IFD0_OFFSET];
- read(mDataAboveIfd0);
+ dataAboveIfd0 = new byte[(int) offset - DEFAULT_IFD0_OFFSET];
+ read(dataAboveIfd0);
}
}
}
@@ -247,23 +247,23 @@ public class ExifParser {
* @see #EVENT_END
*/
protected int next() throws IOException, ExifInvalidFormatException {
- if (!mContainExifData) {
+ if (!containExifData) {
return EVENT_END;
}
- int offset = mTiffStream.getReadByteCount();
- int endOfTags = mIfdStartOffset + OFFSET_SIZE + TAG_SIZE * mNumOfTagInIfd;
+ int offset = tiffStream.getReadByteCount();
+ int endOfTags = ifdStartOffset + OFFSET_SIZE + TAG_SIZE * numOfTagInIfd;
if (offset < endOfTags) {
- mTag = readTag();
- if (mTag == null) {
+ tag = readTag();
+ if (tag == null) {
return next();
}
- if (mNeedToParseOffsetsInCurrentIfd) {
- checkOffsetOrImageTag(mTag);
+ if (needToParseOffsetsInCurrentIfd) {
+ checkOffsetOrImageTag(tag);
}
return EVENT_NEW_TAG;
} else if (offset == endOfTags) {
// There is a link to ifd1 at the end of ifd0
- if (mIfdType == IfdId.TYPE_IFD_0) {
+ if (ifdType == IfdId.TYPE_IFD_0) {
long ifdOffset = readUnsignedLong();
if (isIfdRequested(IfdId.TYPE_IFD_1) || isThumbnailRequested()) {
if (ifdOffset != 0) {
@@ -273,8 +273,8 @@ public class ExifParser {
} else {
int offsetSize = 4;
// Some camera models use invalid length of the offset
- if (mCorrespondingEvent.size() > 0) {
- offsetSize = mCorrespondingEvent.firstEntry().getKey() - mTiffStream.getReadByteCount();
+ if (correspondingEvent.size() > 0) {
+ offsetSize = correspondingEvent.firstEntry().getKey() - tiffStream.getReadByteCount();
}
if (offsetSize < 4) {
LogUtil.i("ExifParser.next", "Invalid size of link to next IFD: " + offsetSize);
@@ -286,8 +286,8 @@ public class ExifParser {
}
}
}
- while (mCorrespondingEvent.size() != 0) {
- Entry<Integer, Object> entry = mCorrespondingEvent.pollFirstEntry();
+ while (correspondingEvent.size() != 0) {
+ Entry<Integer, Object> entry = correspondingEvent.pollFirstEntry();
Object event = entry.getValue();
try {
skipTo(entry.getKey());
@@ -302,30 +302,30 @@ public class ExifParser {
continue;
}
if (event instanceof IfdEvent) {
- mIfdType = ((IfdEvent) event).ifd;
- mNumOfTagInIfd = mTiffStream.readUnsignedShort();
- mIfdStartOffset = entry.getKey();
+ ifdType = ((IfdEvent) event).ifd;
+ numOfTagInIfd = tiffStream.readUnsignedShort();
+ ifdStartOffset = entry.getKey();
- if (mNumOfTagInIfd * TAG_SIZE + mIfdStartOffset + OFFSET_SIZE > mApp1End) {
- LogUtil.i("ExifParser.next", "Invalid size of IFD " + mIfdType);
+ if (numOfTagInIfd * TAG_SIZE + ifdStartOffset + OFFSET_SIZE > app1End) {
+ LogUtil.i("ExifParser.next", "Invalid size of IFD " + ifdType);
return EVENT_END;
}
- mNeedToParseOffsetsInCurrentIfd = needToParseOffsetsInCurrentIfd();
+ needToParseOffsetsInCurrentIfd = needToParseOffsetsInCurrentIfd();
if (((IfdEvent) event).isRequested) {
return EVENT_START_OF_IFD;
} else {
skipRemainingTagsInCurrentIfd();
}
} else if (event instanceof ImageEvent) {
- mImageEvent = (ImageEvent) event;
- return mImageEvent.type;
+ imageEvent = (ImageEvent) event;
+ return imageEvent.type;
} else {
ExifTagEvent tagEvent = (ExifTagEvent) event;
- mTag = tagEvent.tag;
- if (mTag.getDataType() != ExifTag.TYPE_UNDEFINED) {
- readFullTagValue(mTag);
- checkOffsetOrImageTag(mTag);
+ tag = tagEvent.tag;
+ if (tag.getDataType() != ExifTag.TYPE_UNDEFINED) {
+ readFullTagValue(tag);
+ checkOffsetOrImageTag(tag);
}
if (tagEvent.isRequested) {
return EVENT_VALUE_OF_REGISTERED_TAG;
@@ -342,26 +342,26 @@ public class ExifParser {
* @throws ExifInvalidFormatException
*/
private void skipRemainingTagsInCurrentIfd() throws IOException, ExifInvalidFormatException {
- int endOfTags = mIfdStartOffset + OFFSET_SIZE + TAG_SIZE * mNumOfTagInIfd;
- int offset = mTiffStream.getReadByteCount();
+ int endOfTags = ifdStartOffset + OFFSET_SIZE + TAG_SIZE * numOfTagInIfd;
+ int offset = tiffStream.getReadByteCount();
if (offset > endOfTags) {
return;
}
- if (mNeedToParseOffsetsInCurrentIfd) {
+ if (needToParseOffsetsInCurrentIfd) {
while (offset < endOfTags) {
- mTag = readTag();
+ tag = readTag();
offset += TAG_SIZE;
- if (mTag == null) {
+ if (tag == null) {
continue;
}
- checkOffsetOrImageTag(mTag);
+ checkOffsetOrImageTag(tag);
}
} else {
skipTo(endOfTags);
}
long ifdOffset = readUnsignedLong();
// For ifd0, there is a link to ifd1 in the end of all tags
- if (mIfdType == IfdId.TYPE_IFD_0
+ if (ifdType == IfdId.TYPE_IFD_0
&& (isIfdRequested(IfdId.TYPE_IFD_1) || isThumbnailRequested())) {
if (ifdOffset > 0) {
registerIfd(IfdId.TYPE_IFD_1, ifdOffset);
@@ -370,7 +370,7 @@ public class ExifParser {
}
private boolean needToParseOffsetsInCurrentIfd() {
- switch (mIfdType) {
+ switch (ifdType) {
case IfdId.TYPE_IFD_0:
return isIfdRequested(IfdId.TYPE_IFD_EXIF)
|| isIfdRequested(IfdId.TYPE_IFD_GPS)
@@ -408,7 +408,7 @@ public class ExifParser {
* @see #readString(int, java.nio.charset.Charset)
*/
protected ExifTag getTag() {
- return mTag;
+ return tag;
}
/**
@@ -421,7 +421,7 @@ public class ExifParser {
* @see IfdId#TYPE_IFD_EXIF
*/
int getCurrentIfd() {
- return mIfdType;
+ return ifdType;
}
/**
@@ -429,31 +429,31 @@ public class ExifParser {
* strip.
*/
int getStripIndex() {
- return mImageEvent.stripIndex;
+ return imageEvent.stripIndex;
}
/** When receiving {@link #EVENT_UNCOMPRESSED_STRIP}, call this function to get the strip size. */
int getStripSize() {
- if (mStripSizeTag == null) {
+ if (stripSizeTag == null) {
return 0;
}
- return (int) mStripSizeTag.getValueAt(0);
+ return (int) stripSizeTag.getValueAt(0);
}
/**
* When receiving {@link #EVENT_COMPRESSED_IMAGE}, call this function to get the image data size.
*/
int getCompressedImageSize() {
- if (mJpegSizeTag == null) {
+ if (jpegSizeTag == null) {
return 0;
}
- return (int) mJpegSizeTag.getValueAt(0);
+ return (int) jpegSizeTag.getValueAt(0);
}
private void skipTo(int offset) throws IOException {
- mTiffStream.skipTo(offset);
- while (!mCorrespondingEvent.isEmpty() && mCorrespondingEvent.firstKey() < offset) {
- mCorrespondingEvent.pollFirstEntry();
+ tiffStream.skipTo(offset);
+ while (!correspondingEvent.isEmpty() && correspondingEvent.firstKey() < offset) {
+ correspondingEvent.pollFirstEntry();
}
}
@@ -466,37 +466,37 @@ public class ExifParser {
* @see #EVENT_VALUE_OF_REGISTERED_TAG
*/
void registerForTagValue(ExifTag tag) {
- if (tag.getOffset() >= mTiffStream.getReadByteCount()) {
- mCorrespondingEvent.put(tag.getOffset(), new ExifTagEvent(tag, true));
+ if (tag.getOffset() >= tiffStream.getReadByteCount()) {
+ correspondingEvent.put(tag.getOffset(), new ExifTagEvent(tag, true));
}
}
private void registerIfd(int ifdType, long offset) {
// Cast unsigned int to int since the offset is always smaller
// than the size of APP1 (65536)
- mCorrespondingEvent.put((int) offset, new IfdEvent(ifdType, isIfdRequested(ifdType)));
+ correspondingEvent.put((int) offset, new IfdEvent(ifdType, isIfdRequested(ifdType)));
}
private void registerCompressedImage(long offset) {
- mCorrespondingEvent.put((int) offset, new ImageEvent(EVENT_COMPRESSED_IMAGE));
+ correspondingEvent.put((int) offset, new ImageEvent(EVENT_COMPRESSED_IMAGE));
}
private void registerUncompressedStrip(int stripIndex, long offset) {
- mCorrespondingEvent.put((int) offset, new ImageEvent(EVENT_UNCOMPRESSED_STRIP, stripIndex));
+ correspondingEvent.put((int) offset, new ImageEvent(EVENT_UNCOMPRESSED_STRIP, stripIndex));
}
@SuppressLint("DefaultLocale")
private ExifTag readTag() throws IOException, ExifInvalidFormatException {
- short tagId = mTiffStream.readShort();
- short dataFormat = mTiffStream.readShort();
- long numOfComp = mTiffStream.readUnsignedInt();
+ short tagId = tiffStream.readShort();
+ short dataFormat = tiffStream.readShort();
+ long numOfComp = tiffStream.readUnsignedInt();
if (numOfComp > Integer.MAX_VALUE) {
throw new ExifInvalidFormatException("Number of component is larger then Integer.MAX_VALUE");
}
// Some invalid image file contains invalid data type. Ignore those tags
if (!ExifTag.isValidType(dataFormat)) {
LogUtil.i("ExifParser.readTag", "Tag %04x: Invalid data type %d", tagId, dataFormat);
- mTiffStream.skip(4);
+ tiffStream.skip(4);
return null;
}
// TODO(blemmon): handle numOfComp overflow
@@ -505,20 +505,20 @@ public class ExifParser {
tagId,
dataFormat,
(int) numOfComp,
- mIfdType,
+ ifdType,
((int) numOfComp) != ExifTag.SIZE_UNDEFINED);
int dataSize = tag.getDataSize();
if (dataSize > 4) {
- long offset = mTiffStream.readUnsignedInt();
+ long offset = tiffStream.readUnsignedInt();
if (offset > Integer.MAX_VALUE) {
throw new ExifInvalidFormatException("offset is larger then Integer.MAX_VALUE");
}
// Some invalid images put some undefined data before IFD0.
// Read the data here.
- if ((offset < mIfd0Position) && (dataFormat == ExifTag.TYPE_UNDEFINED)) {
+ if ((offset < ifd0Position) && (dataFormat == ExifTag.TYPE_UNDEFINED)) {
byte[] buf = new byte[(int) numOfComp];
System.arraycopy(
- mDataAboveIfd0, (int) offset - DEFAULT_IFD0_OFFSET, buf, 0, (int) numOfComp);
+ dataAboveIfd0, (int) offset - DEFAULT_IFD0_OFFSET, buf, 0, (int) numOfComp);
tag.setValue(buf);
} else {
tag.setOffset((int) offset);
@@ -530,9 +530,9 @@ public class ExifParser {
// Read value
readFullTagValue(tag);
tag.setHasDefinedCount(defCount);
- mTiffStream.skip(4 - dataSize);
+ tiffStream.skip(4 - dataSize);
// Set the offset to the position of value.
- tag.setOffset(mTiffStream.getReadByteCount() - 4);
+ tag.setOffset(tiffStream.getReadByteCount() - 4);
}
return tag;
}
@@ -569,7 +569,7 @@ public class ExifParser {
} else if (tid == TAG_JPEG_INTERCHANGE_FORMAT_LENGTH
&& checkAllowed(ifd, ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT_LENGTH)) {
if (isThumbnailRequested()) {
- mJpegSizeTag = tag;
+ jpegSizeTag = tag;
}
} else if (tid == TAG_STRIP_OFFSETS && checkAllowed(ifd, ExifInterface.TAG_STRIP_OFFSETS)) {
if (isThumbnailRequested()) {
@@ -582,14 +582,14 @@ public class ExifParser {
}
}
} else {
- mCorrespondingEvent.put(tag.getOffset(), new ExifTagEvent(tag, false));
+ correspondingEvent.put(tag.getOffset(), new ExifTagEvent(tag, false));
}
}
} else if (tid == TAG_STRIP_BYTE_COUNTS
&& checkAllowed(ifd, ExifInterface.TAG_STRIP_BYTE_COUNTS)
&& isThumbnailRequested()
&& tag.hasValue()) {
- mStripSizeTag = tag;
+ stripSizeTag = tag;
}
}
@@ -605,15 +605,15 @@ public class ExifParser {
|| type == ExifTag.TYPE_UNDEFINED
|| type == ExifTag.TYPE_UNSIGNED_BYTE) {
int size = tag.getComponentCount();
- if (mCorrespondingEvent.size() > 0) {
- if (mCorrespondingEvent.firstEntry().getKey() < mTiffStream.getReadByteCount() + size) {
- Object event = mCorrespondingEvent.firstEntry().getValue();
+ if (correspondingEvent.size() > 0) {
+ if (correspondingEvent.firstEntry().getKey() < tiffStream.getReadByteCount() + size) {
+ Object event = correspondingEvent.firstEntry().getValue();
if (event instanceof ImageEvent) {
// Tag value overlaps thumbnail, ignore thumbnail.
LogUtil.i(
"ExifParser.readFullTagValue",
"Thumbnail overlaps value for tag: \n" + tag.toString());
- Entry<Integer, Object> entry = mCorrespondingEvent.pollFirstEntry();
+ Entry<Integer, Object> entry = correspondingEvent.pollFirstEntry();
LogUtil.i("ExifParser.readFullTagValue", "Invalid thumbnail offset: " + entry.getKey());
} else {
// Tag value overlaps another shorten count
@@ -629,7 +629,7 @@ public class ExifParser {
+ " overlaps value for tag: \n"
+ tag.toString());
}
- size = mCorrespondingEvent.firstEntry().getKey() - mTiffStream.getReadByteCount();
+ size = correspondingEvent.firstEntry().getKey() - tiffStream.getReadByteCount();
LogUtil.i(
"ExifParser.readFullTagValue",
"Invalid size of tag: \n" + tag.toString() + " setting count to: " + size);
@@ -702,16 +702,16 @@ public class ExifParser {
}
private void parseTiffHeader() throws IOException, ExifInvalidFormatException {
- short byteOrder = mTiffStream.readShort();
+ short byteOrder = tiffStream.readShort();
if (LITTLE_ENDIAN_TAG == byteOrder) {
- mTiffStream.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ tiffStream.setByteOrder(ByteOrder.LITTLE_ENDIAN);
} else if (BIG_ENDIAN_TAG == byteOrder) {
- mTiffStream.setByteOrder(ByteOrder.BIG_ENDIAN);
+ tiffStream.setByteOrder(ByteOrder.BIG_ENDIAN);
} else {
throw new ExifInvalidFormatException("Invalid TIFF header");
}
- if (mTiffStream.readShort() != TIFF_HEADER_TAIL) {
+ if (tiffStream.readShort() != TIFF_HEADER_TAIL) {
throw new ExifInvalidFormatException("Invalid TIFF header");
}
}
@@ -736,7 +736,7 @@ public class ExifParser {
headerTail = dataStream.readShort();
length -= 6;
if (header == EXIF_HEADER && headerTail == EXIF_HEADER_TAIL) {
- mApp1End = length;
+ app1End = length;
return true;
}
}
@@ -752,12 +752,12 @@ public class ExifParser {
/** Reads bytes from the InputStream. */
protected int read(byte[] buffer, int offset, int length) throws IOException {
- return mTiffStream.read(buffer, offset, length);
+ return tiffStream.read(buffer, offset, length);
}
/** Equivalent to read(buffer, 0, buffer.length). */
protected int read(byte[] buffer) throws IOException {
- return mTiffStream.read(buffer);
+ return tiffStream.read(buffer);
}
/**
@@ -774,7 +774,7 @@ public class ExifParser {
*/
private String readString(int n, Charset charset) throws IOException {
if (n > 0) {
- return mTiffStream.readString(n, charset);
+ return tiffStream.readString(n, charset);
} else {
return "";
}
@@ -782,7 +782,7 @@ public class ExifParser {
/** Reads value of type {@link ExifTag#TYPE_UNSIGNED_SHORT} from the InputStream. */
private int readUnsignedShort() throws IOException {
- return mTiffStream.readShort() & 0xffff;
+ return tiffStream.readShort() & 0xffff;
}
/** Reads value of type {@link ExifTag#TYPE_UNSIGNED_LONG} from the InputStream. */
@@ -799,7 +799,7 @@ public class ExifParser {
/** Reads value of type {@link ExifTag#TYPE_LONG} from the InputStream. */
private int readLong() throws IOException {
- return mTiffStream.readInt();
+ return tiffStream.readInt();
}
/** Reads value of type {@link ExifTag#TYPE_RATIONAL} from the InputStream. */
diff --git a/java/com/android/dialer/callcomposer/camera/exif/ExifTag.java b/java/com/android/dialer/callcomposer/camera/exif/ExifTag.java
index 9a03c103c..23948ed62 100644
--- a/java/com/android/dialer/callcomposer/camera/exif/ExifTag.java
+++ b/java/com/android/dialer/callcomposer/camera/exif/ExifTag.java
@@ -81,19 +81,19 @@ public class ExifTag {
static final int SIZE_UNDEFINED = 0;
// Exif TagId
- private final short mTagId;
+ private final short tagId;
// Exif Tag Type
- private final short mDataType;
+ private final short dataType;
// If tag has defined count
- private boolean mHasDefinedDefaultComponentCount;
+ private boolean hasDefinedDefaultComponentCount;
// Actual data count in tag (should be number of elements in value array)
- private int mComponentCountActual;
+ private int componentCountActual;
// The ifd that this tag should be put in
- private int mIfd;
+ private int ifd;
// The value (array of elements of type Tag Type)
- private Object mValue;
+ private Object value;
// Value offset in exif header.
- private int mOffset;
+ private int offset;
/** Returns true if the given IFD is a valid IFD. */
static boolean isValidIfd(int ifdId) {
@@ -118,12 +118,12 @@ public class ExifTag {
// Use builtTag in ExifInterface instead of constructor.
ExifTag(short tagId, short type, int componentCount, int ifd, boolean hasDefinedComponentCount) {
- mTagId = tagId;
- mDataType = type;
- mComponentCountActual = componentCount;
- mHasDefinedDefaultComponentCount = hasDefinedComponentCount;
- mIfd = ifd;
- mValue = null;
+ this.tagId = tagId;
+ dataType = type;
+ componentCountActual = componentCount;
+ hasDefinedDefaultComponentCount = hasDefinedComponentCount;
+ this.ifd = ifd;
+ value = null;
}
/**
@@ -152,16 +152,16 @@ public class ExifTag {
* @see IfdId#TYPE_IFD_INTEROPERABILITY
*/
int getIfd() {
- return mIfd;
+ return ifd;
}
void setIfd(int ifdId) {
- mIfd = ifdId;
+ ifd = ifdId;
}
/** Gets the TID of this tag. */
short getTagId() {
- return mTagId;
+ return tagId;
}
/**
@@ -177,7 +177,7 @@ public class ExifTag {
* @see #TYPE_UNSIGNED_SHORT
*/
short getDataType() {
- return mDataType;
+ return dataType;
}
/** Gets the total data size in bytes of the value of this tag. */
@@ -189,7 +189,7 @@ public class ExifTag {
// TODO(blemmon): fix integer overflows with this
int getComponentCount() {
- return mComponentCountActual;
+ return componentCountActual;
}
/**
@@ -197,7 +197,7 @@ public class ExifTag {
* value does not match the component count.
*/
void forceSetComponentCount(int count) {
- mComponentCountActual = count;
+ componentCountActual = count;
}
/**
@@ -205,7 +205,7 @@ public class ExifTag {
* that is determined when the tag is written.
*/
boolean hasValue() {
- return mValue != null;
+ return value != null;
}
/**
@@ -223,14 +223,14 @@ public class ExifTag {
if (checkBadComponentCount(value.length)) {
return false;
}
- if (mDataType != TYPE_UNSIGNED_SHORT
- && mDataType != TYPE_LONG
- && mDataType != TYPE_UNSIGNED_LONG) {
+ if (dataType != TYPE_UNSIGNED_SHORT
+ && dataType != TYPE_LONG
+ && dataType != TYPE_UNSIGNED_LONG) {
return false;
}
- if (mDataType == TYPE_UNSIGNED_SHORT && checkOverflowForUnsignedShort(value)) {
+ if (dataType == TYPE_UNSIGNED_SHORT && checkOverflowForUnsignedShort(value)) {
return false;
- } else if (mDataType == TYPE_UNSIGNED_LONG && checkOverflowForUnsignedLong(value)) {
+ } else if (dataType == TYPE_UNSIGNED_LONG && checkOverflowForUnsignedLong(value)) {
return false;
}
@@ -238,8 +238,8 @@ public class ExifTag {
for (int i = 0; i < value.length; i++) {
data[i] = value[i];
}
- mValue = data;
- mComponentCountActual = value.length;
+ this.value = data;
+ componentCountActual = value.length;
return true;
}
@@ -254,14 +254,14 @@ public class ExifTag {
* </ul>
*/
boolean setValue(long[] value) {
- if (checkBadComponentCount(value.length) || mDataType != TYPE_UNSIGNED_LONG) {
+ if (checkBadComponentCount(value.length) || dataType != TYPE_UNSIGNED_LONG) {
return false;
}
if (checkOverflowForUnsignedLong(value)) {
return false;
}
- mValue = value;
- mComponentCountActual = value.length;
+ this.value = value;
+ componentCountActual = value.length;
return true;
}
@@ -280,7 +280,7 @@ public class ExifTag {
* </ul>
*/
boolean setValue(String value) {
- if (mDataType != TYPE_ASCII && mDataType != TYPE_UNDEFINED) {
+ if (dataType != TYPE_ASCII && dataType != TYPE_UNDEFINED) {
return false;
}
@@ -288,18 +288,18 @@ public class ExifTag {
byte[] finalBuf = buf;
if (buf.length > 0) {
finalBuf =
- (buf[buf.length - 1] == 0 || mDataType == TYPE_UNDEFINED)
+ (buf[buf.length - 1] == 0 || dataType == TYPE_UNDEFINED)
? buf
: Arrays.copyOf(buf, buf.length + 1);
- } else if (mDataType == TYPE_ASCII && mComponentCountActual == 1) {
+ } else if (dataType == TYPE_ASCII && componentCountActual == 1) {
finalBuf = new byte[] {0};
}
int count = finalBuf.length;
if (checkBadComponentCount(count)) {
return false;
}
- mComponentCountActual = count;
- mValue = finalBuf;
+ componentCountActual = count;
+ this.value = finalBuf;
return true;
}
@@ -320,17 +320,17 @@ public class ExifTag {
if (checkBadComponentCount(value.length)) {
return false;
}
- if (mDataType != TYPE_UNSIGNED_RATIONAL && mDataType != TYPE_RATIONAL) {
+ if (dataType != TYPE_UNSIGNED_RATIONAL && dataType != TYPE_RATIONAL) {
return false;
}
- if (mDataType == TYPE_UNSIGNED_RATIONAL && checkOverflowForUnsignedRational(value)) {
+ if (dataType == TYPE_UNSIGNED_RATIONAL && checkOverflowForUnsignedRational(value)) {
return false;
- } else if (mDataType == TYPE_RATIONAL && checkOverflowForRational(value)) {
+ } else if (dataType == TYPE_RATIONAL && checkOverflowForRational(value)) {
return false;
}
- mValue = value;
- mComponentCountActual = value.length;
+ this.value = value;
+ componentCountActual = value.length;
return true;
}
@@ -348,12 +348,12 @@ public class ExifTag {
if (checkBadComponentCount(length)) {
return false;
}
- if (mDataType != TYPE_UNSIGNED_BYTE && mDataType != TYPE_UNDEFINED) {
+ if (dataType != TYPE_UNSIGNED_BYTE && dataType != TYPE_UNDEFINED) {
return false;
}
- mValue = new byte[length];
- System.arraycopy(value, offset, mValue, 0, length);
- mComponentCountActual = length;
+ this.value = new byte[length];
+ System.arraycopy(value, offset, this.value, 0, length);
+ componentCountActual = length;
return true;
}
@@ -370,10 +370,10 @@ public class ExifTag {
* be converted to an array of ints.
*/
int[] getValueAsInts() {
- if (mValue == null) {
+ if (value == null) {
return null;
- } else if (mValue instanceof long[]) {
- long[] val = (long[]) mValue;
+ } else if (value instanceof long[]) {
+ long[] val = (long[]) value;
int[] arr = new int[val.length];
for (int i = 0; i < val.length; i++) {
arr[i] = (int) val[i]; // Truncates
@@ -385,38 +385,38 @@ public class ExifTag {
/** Gets the tag's value or null if none exists. */
public Object getValue() {
- return mValue;
+ return value;
}
/** Gets a string representation of the value. */
private String forceGetValueAsString() {
- if (mValue == null) {
+ if (value == null) {
return "";
- } else if (mValue instanceof byte[]) {
- if (mDataType == TYPE_ASCII) {
- return new String((byte[]) mValue, US_ASCII);
+ } else if (value instanceof byte[]) {
+ if (dataType == TYPE_ASCII) {
+ return new String((byte[]) value, US_ASCII);
} else {
- return Arrays.toString((byte[]) mValue);
+ return Arrays.toString((byte[]) value);
}
- } else if (mValue instanceof long[]) {
- if (((long[]) mValue).length == 1) {
- return String.valueOf(((long[]) mValue)[0]);
+ } else if (value instanceof long[]) {
+ if (((long[]) value).length == 1) {
+ return String.valueOf(((long[]) value)[0]);
} else {
- return Arrays.toString((long[]) mValue);
+ return Arrays.toString((long[]) value);
}
- } else if (mValue instanceof Object[]) {
- if (((Object[]) mValue).length == 1) {
- Object val = ((Object[]) mValue)[0];
+ } else if (value instanceof Object[]) {
+ if (((Object[]) value).length == 1) {
+ Object val = ((Object[]) value)[0];
if (val == null) {
return "";
} else {
return val.toString();
}
} else {
- return Arrays.toString((Object[]) mValue);
+ return Arrays.toString((Object[]) value);
}
} else {
- return mValue.toString();
+ return value.toString();
}
}
@@ -428,13 +428,13 @@ public class ExifTag {
* #TYPE_UNSIGNED_RATIONAL}.
*/
long getValueAt(int index) {
- if (mValue instanceof long[]) {
- return ((long[]) mValue)[index];
- } else if (mValue instanceof byte[]) {
- return ((byte[]) mValue)[index];
+ if (value instanceof long[]) {
+ return ((long[]) value)[index];
+ } else if (value instanceof byte[]) {
+ return ((byte[]) value)[index];
}
throw new IllegalArgumentException(
- "Cannot get integer value from " + convertTypeToString(mDataType));
+ "Cannot get integer value from " + convertTypeToString(dataType));
}
/**
@@ -443,11 +443,11 @@ public class ExifTag {
* @exception IllegalArgumentException If the type is NOT {@link #TYPE_ASCII}.
*/
protected String getString() {
- if (mDataType != TYPE_ASCII) {
+ if (dataType != TYPE_ASCII) {
throw new IllegalArgumentException(
- "Cannot get ASCII value from " + convertTypeToString(mDataType));
+ "Cannot get ASCII value from " + convertTypeToString(dataType));
}
- return new String((byte[]) mValue, US_ASCII);
+ return new String((byte[]) value, US_ASCII);
}
/**
@@ -455,24 +455,24 @@ public class ExifTag {
* the location of the actual value.
*/
protected int getOffset() {
- return mOffset;
+ return offset;
}
/** Sets the offset of this tag. */
protected void setOffset(int offset) {
- mOffset = offset;
+ this.offset = offset;
}
void setHasDefinedCount(boolean d) {
- mHasDefinedDefaultComponentCount = d;
+ hasDefinedDefaultComponentCount = d;
}
boolean hasDefinedCount() {
- return mHasDefinedDefaultComponentCount;
+ return hasDefinedDefaultComponentCount;
}
private boolean checkBadComponentCount(int count) {
- return mHasDefinedDefaultComponentCount && (mComponentCountActual != count);
+ return hasDefinedDefaultComponentCount && (componentCountActual != count);
}
private static String convertTypeToString(short type) {
@@ -556,34 +556,34 @@ public class ExifTag {
}
if (obj instanceof ExifTag) {
ExifTag tag = (ExifTag) obj;
- if (tag.mTagId != this.mTagId
- || tag.mComponentCountActual != this.mComponentCountActual
- || tag.mDataType != this.mDataType) {
+ if (tag.tagId != this.tagId
+ || tag.componentCountActual != this.componentCountActual
+ || tag.dataType != this.dataType) {
return false;
}
- if (mValue != null) {
- if (tag.mValue == null) {
+ if (value != null) {
+ if (tag.value == null) {
return false;
- } else if (mValue instanceof long[]) {
- if (!(tag.mValue instanceof long[])) {
+ } else if (value instanceof long[]) {
+ if (!(tag.value instanceof long[])) {
return false;
}
- return Arrays.equals((long[]) mValue, (long[]) tag.mValue);
- } else if (mValue instanceof Rational[]) {
- if (!(tag.mValue instanceof Rational[])) {
+ return Arrays.equals((long[]) value, (long[]) tag.value);
+ } else if (value instanceof Rational[]) {
+ if (!(tag.value instanceof Rational[])) {
return false;
}
- return Arrays.equals((Rational[]) mValue, (Rational[]) tag.mValue);
- } else if (mValue instanceof byte[]) {
- if (!(tag.mValue instanceof byte[])) {
+ return Arrays.equals((Rational[]) value, (Rational[]) tag.value);
+ } else if (value instanceof byte[]) {
+ if (!(tag.value instanceof byte[])) {
return false;
}
- return Arrays.equals((byte[]) mValue, (byte[]) tag.mValue);
+ return Arrays.equals((byte[]) value, (byte[]) tag.value);
} else {
- return mValue.equals(tag.mValue);
+ return value.equals(tag.value);
}
} else {
- return tag.mValue == null;
+ return tag.value == null;
}
}
return false;
@@ -592,26 +592,20 @@ public class ExifTag {
@Override
public int hashCode() {
return Objects.hash(
- mTagId,
- mDataType,
- mHasDefinedDefaultComponentCount,
- mComponentCountActual,
- mIfd,
- mValue,
- mOffset);
+ tagId, dataType, hasDefinedDefaultComponentCount, componentCountActual, ifd, value, offset);
}
@Override
public String toString() {
- return String.format("tag id: %04X\n", mTagId)
+ return String.format("tag id: %04X\n", tagId)
+ "ifd id: "
- + mIfd
+ + ifd
+ "\ntype: "
- + convertTypeToString(mDataType)
+ + convertTypeToString(dataType)
+ "\ncount: "
- + mComponentCountActual
+ + componentCountActual
+ "\noffset: "
- + mOffset
+ + offset
+ "\nvalue: "
+ forceGetValueAsString()
+ "\n";
diff --git a/java/com/android/dialer/callcomposer/camera/exif/IfdData.java b/java/com/android/dialer/callcomposer/camera/exif/IfdData.java
index b808defc6..e85919e0a 100644
--- a/java/com/android/dialer/callcomposer/camera/exif/IfdData.java
+++ b/java/com/android/dialer/callcomposer/camera/exif/IfdData.java
@@ -16,7 +16,7 @@
package com.android.dialer.callcomposer.camera.exif;
-import java.util.HashMap;
+import android.support.v4.util.ArrayMap;
import java.util.Map;
import java.util.Objects;
@@ -28,9 +28,9 @@ import java.util.Objects;
*/
class IfdData {
- private final int mIfdId;
- private final Map<Short, ExifTag> mExifTags = new HashMap<>();
- private static final int[] sIfds = {
+ private final int ifdId;
+ private final Map<Short, ExifTag> exifTags = new ArrayMap<>();
+ private static final int[] ifds = {
IfdId.TYPE_IFD_0,
IfdId.TYPE_IFD_1,
IfdId.TYPE_IFD_EXIF,
@@ -47,16 +47,16 @@ class IfdData {
* @see IfdId#TYPE_IFD_INTEROPERABILITY
*/
IfdData(int ifdId) {
- mIfdId = ifdId;
+ this.ifdId = ifdId;
}
static int[] getIfds() {
- return sIfds;
+ return ifds;
}
/** Get a array the contains all {@link ExifTag} in this IFD. */
private ExifTag[] getAllTags() {
- return mExifTags.values().toArray(new ExifTag[mExifTags.size()]);
+ return exifTags.values().toArray(new ExifTag[exifTags.size()]);
}
/**
@@ -69,23 +69,23 @@ class IfdData {
* @see IfdId#TYPE_IFD_INTEROPERABILITY
*/
protected int getId() {
- return mIfdId;
+ return ifdId;
}
/** Gets the {@link ExifTag} with given tag id. Return null if there is no such tag. */
protected ExifTag getTag(short tagId) {
- return mExifTags.get(tagId);
+ return exifTags.get(tagId);
}
/** Adds or replaces a {@link ExifTag}. */
protected ExifTag setTag(ExifTag tag) {
- tag.setIfd(mIfdId);
- return mExifTags.put(tag.getTagId(), tag);
+ tag.setIfd(ifdId);
+ return exifTags.put(tag.getTagId(), tag);
}
/** Gets the tags count in the IFD. */
private int getTagCount() {
- return mExifTags.size();
+ return exifTags.size();
}
/**
@@ -102,13 +102,13 @@ class IfdData {
}
if (obj instanceof IfdData) {
IfdData data = (IfdData) obj;
- if (data.getId() == mIfdId && data.getTagCount() == getTagCount()) {
+ if (data.getId() == ifdId && data.getTagCount() == getTagCount()) {
ExifTag[] tags = data.getAllTags();
for (ExifTag tag : tags) {
if (ExifInterface.isOffsetTag(tag.getTagId())) {
continue;
}
- ExifTag tag2 = mExifTags.get(tag.getTagId());
+ ExifTag tag2 = exifTags.get(tag.getTagId());
if (!tag.equals(tag2)) {
return false;
}
@@ -121,6 +121,6 @@ class IfdData {
@Override
public int hashCode() {
- return Objects.hash(mIfdId, mExifTags);
+ return Objects.hash(ifdId, exifTags);
}
}
diff --git a/java/com/android/dialer/callcomposer/camera/exif/Rational.java b/java/com/android/dialer/callcomposer/camera/exif/Rational.java
index 9afca8449..d07778c31 100644
--- a/java/com/android/dialer/callcomposer/camera/exif/Rational.java
+++ b/java/com/android/dialer/callcomposer/camera/exif/Rational.java
@@ -24,23 +24,23 @@ import java.util.Objects;
*/
public class Rational {
- private final long mNumerator;
- private final long mDenominator;
+ private final long numerator;
+ private final long denominator;
/** Create a Rational with a given numerator and denominator. */
Rational(long nominator, long denominator) {
- mNumerator = nominator;
- mDenominator = denominator;
+ numerator = nominator;
+ this.denominator = denominator;
}
/** Gets the numerator of the rational. */
long getNumerator() {
- return mNumerator;
+ return numerator;
}
/** Gets the denominator of the rational */
long getDenominator() {
- return mDenominator;
+ return denominator;
}
@Override
@@ -53,18 +53,18 @@ public class Rational {
}
if (obj instanceof Rational) {
Rational data = (Rational) obj;
- return mNumerator == data.mNumerator && mDenominator == data.mDenominator;
+ return numerator == data.numerator && denominator == data.denominator;
}
return false;
}
@Override
public int hashCode() {
- return Objects.hash(mNumerator, mDenominator);
+ return Objects.hash(numerator, denominator);
}
@Override
public String toString() {
- return mNumerator + "/" + mDenominator;
+ return numerator + "/" + denominator;
}
}