Java Code Examples for com.android.dex.SizeOf#PROTO_ID_ITEM
The following examples show how to use
com.android.dex.SizeOf#PROTO_ID_ITEM .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DexMerger.java From buck with Apache License 2.0 | 5 votes |
private void plus(Dex d, boolean exact) { TableOfContents contents = d.getTableOfContents(); idsDefs += contents.stringIds.size * SizeOf.STRING_ID_ITEM + contents.typeIds.size * SizeOf.TYPE_ID_ITEM + contents.protoIds.size * SizeOf.PROTO_ID_ITEM + contents.fieldIds.size * SizeOf.MEMBER_ID_ITEM + contents.methodIds.size * SizeOf.MEMBER_ID_ITEM + contents.classDefs.size * SizeOf.CLASS_DEF_ITEM; mapList = SizeOf.UINT + (contents.sections.length * SizeOf.MAP_ITEM); typeList += fourByteAlign(contents.typeLists.byteCount); // We count each dex's // typelists section as realigned on 4 bytes, because each typelist of each dex's // typelists section is aligned on 4 bytes. If we didn't, there is a case where each // size of both dex's typelists section is a multiple of 2 but not a multiple of 4, // and the sum of both sizes is a multiple of 4 but would not be sufficient to write // each typelist aligned on 4 bytes. stringData += contents.stringDatas.byteCount; annotationsDirectory += contents.annotationsDirectories.byteCount; annotationsSet += contents.annotationSets.byteCount; annotationsSetRefList += contents.annotationSetRefLists.byteCount; if (exact) { code += contents.codes.byteCount; classData += contents.classDatas.byteCount; encodedArray += contents.encodedArrays.byteCount; annotation += contents.annotations.byteCount; debugInfo += contents.debugInfos.byteCount; } else { // at most 1/4 of the bytes in a code section are uleb/sleb code += (int) Math.ceil(contents.codes.byteCount * 1.25); // at most 1/3 of the bytes in a class data section are uleb/sleb classData += (int) Math.ceil(contents.classDatas.byteCount * 1.34); // all of the bytes in an encoding arrays section may be uleb/sleb encodedArray += contents.encodedArrays.byteCount * 2; // all of the bytes in an annotations section may be uleb/sleb annotation += (int) Math.ceil(contents.annotations.byteCount * 2); // all of the bytes in a debug info section may be uleb/sleb debugInfo += computeDuplicatedDebugInfoSize(d) * 2; } }
Example 2
Source File: ProtoIdItem.java From Box with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public int writeSize() { return SizeOf.PROTO_ID_ITEM; }
Example 3
Source File: DexMerger.java From Box with Apache License 2.0 | 4 votes |
private void plus(TableOfContents contents, boolean exact) { idsDefs += contents.stringIds.size * SizeOf.STRING_ID_ITEM + contents.typeIds.size * SizeOf.TYPE_ID_ITEM + contents.protoIds.size * SizeOf.PROTO_ID_ITEM + contents.fieldIds.size * SizeOf.MEMBER_ID_ITEM + contents.methodIds.size * SizeOf.MEMBER_ID_ITEM + contents.classDefs.size * SizeOf.CLASS_DEF_ITEM; mapList = SizeOf.UINT + (contents.sections.length * SizeOf.MAP_ITEM); typeList += fourByteAlign(contents.typeLists.byteCount); // We count each dex's // typelists section as realigned on 4 bytes, because each typelist of each dex's // typelists section is aligned on 4 bytes. If we didn't, there is a case where each // size of both dex's typelists section is a multiple of 2 but not a multiple of 4, // and the sum of both sizes is a multiple of 4 but would not be sufficient to write // each typelist aligned on 4 bytes. stringData += contents.stringDatas.byteCount; annotationsDirectory += contents.annotationsDirectories.byteCount; annotationsSet += contents.annotationSets.byteCount; annotationsSetRefList += contents.annotationSetRefLists.byteCount; if (exact) { code += contents.codes.byteCount; classData += contents.classDatas.byteCount; encodedArray += contents.encodedArrays.byteCount; annotation += contents.annotations.byteCount; debugInfo += contents.debugInfos.byteCount; } else { // at most 1/4 of the bytes in a code section are uleb/sleb code += (int) Math.ceil(contents.codes.byteCount * 1.25); // at most 2/3 of the bytes in a class data section are uleb/sleb that may change // (assuming the worst case that section contains only methods and no fields) classData += (int) Math.ceil(contents.classDatas.byteCount * 1.67); // all of the bytes in an encoding arrays section may be uleb/sleb encodedArray += contents.encodedArrays.byteCount * 2; // all of the bytes in an annotations section may be uleb/sleb annotation += (int) Math.ceil(contents.annotations.byteCount * 2); // all of the bytes in a debug info section may be uleb/sleb. The additive constant // is a fudge factor observed to be required when merging small // DEX files (b/68483205). debugInfo += contents.debugInfos.byteCount * 2 + 8; } }
Example 4
Source File: ProtoIdItem.java From Box with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public int writeSize() { return SizeOf.PROTO_ID_ITEM; }
Example 5
Source File: DexMerger.java From Box with Apache License 2.0 | 4 votes |
private void plus(TableOfContents contents, boolean exact) { idsDefs += contents.stringIds.size * SizeOf.STRING_ID_ITEM + contents.typeIds.size * SizeOf.TYPE_ID_ITEM + contents.protoIds.size * SizeOf.PROTO_ID_ITEM + contents.fieldIds.size * SizeOf.MEMBER_ID_ITEM + contents.methodIds.size * SizeOf.MEMBER_ID_ITEM + contents.classDefs.size * SizeOf.CLASS_DEF_ITEM; mapList = SizeOf.UINT + (contents.sections.length * SizeOf.MAP_ITEM); typeList += fourByteAlign(contents.typeLists.byteCount); // We count each dex's // typelists section as realigned on 4 bytes, because each typelist of each dex's // typelists section is aligned on 4 bytes. If we didn't, there is a case where each // size of both dex's typelists section is a multiple of 2 but not a multiple of 4, // and the sum of both sizes is a multiple of 4 but would not be sufficient to write // each typelist aligned on 4 bytes. stringData += contents.stringDatas.byteCount; annotationsDirectory += contents.annotationsDirectories.byteCount; annotationsSet += contents.annotationSets.byteCount; annotationsSetRefList += contents.annotationSetRefLists.byteCount; if (exact) { code += contents.codes.byteCount; classData += contents.classDatas.byteCount; encodedArray += contents.encodedArrays.byteCount; annotation += contents.annotations.byteCount; debugInfo += contents.debugInfos.byteCount; } else { // at most 1/4 of the bytes in a code section are uleb/sleb code += (int) Math.ceil(contents.codes.byteCount * 1.25); // at most 2/3 of the bytes in a class data section are uleb/sleb that may change // (assuming the worst case that section contains only methods and no fields) classData += (int) Math.ceil(contents.classDatas.byteCount * 1.67); // all of the bytes in an encoding arrays section may be uleb/sleb encodedArray += contents.encodedArrays.byteCount * 2; // all of the bytes in an annotations section may be uleb/sleb annotation += (int) Math.ceil(contents.annotations.byteCount * 2); // all of the bytes in a debug info section may be uleb/sleb. The additive constant // is a fudge factor observed to be required when merging small // DEX files (b/68483205). debugInfo += contents.debugInfos.byteCount * 2 + 8; } }
Example 6
Source File: ProtoIdItem.java From J2ME-Loader with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public int writeSize() { return SizeOf.PROTO_ID_ITEM; }
Example 7
Source File: ProtoIdItem.java From buck with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public int writeSize() { return SizeOf.PROTO_ID_ITEM; }