summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdnan Begovic <adnan@cyngn.com>2016-03-02 16:35:51 -0800
committerMichael Bestas <mkbestas@lineageos.org>2018-01-01 02:37:22 +0200
commit3e6d3cf101131ab785438b235cc636ab88f1bd3d (patch)
tree2448690e9e94fa6e8c73080f66132e5affbefa1d
parent02fc806bbb3ce8d96049ed83a55d5969e1c506a1 (diff)
downloadandroid_dalvik-3e6d3cf101131ab785438b235cc636ab88f1bd3d.tar.gz
android_dalvik-3e6d3cf101131ab785438b235cc636ab88f1bd3d.tar.bz2
android_dalvik-3e6d3cf101131ab785438b235cc636ab88f1bd3d.zip
dexdeps: Add option for --include-lineage-classes.
dexdeps will filter out classes that are marked as internal when dumping class references from the classes.dex. Include a hack to allow public cm classes to be accessible via the dump. This is then utilized to generate an html page for api coverage. Change-Id: I1f2a8c28b33711235f46adf2f4a98102e72b3d74
-rw-r--r--tools/dexdeps/src/com/android/dexdeps/DexData.java10
-rw-r--r--tools/dexdeps/src/com/android/dexdeps/Main.java9
2 files changed, 15 insertions, 4 deletions
diff --git a/tools/dexdeps/src/com/android/dexdeps/DexData.java b/tools/dexdeps/src/com/android/dexdeps/DexData.java
index 448c21e32..097c27fcd 100644
--- a/tools/dexdeps/src/com/android/dexdeps/DexData.java
+++ b/tools/dexdeps/src/com/android/dexdeps/DexData.java
@@ -50,7 +50,7 @@ public class DexData {
* @throws IOException if we encounter a problem while reading
* @throws DexDataException if the DEX contents look bad
*/
- public void load() throws IOException {
+ public void load(boolean includeLineageClasses) throws IOException {
parseHeaderItem();
loadStrings();
@@ -60,7 +60,7 @@ public class DexData {
loadMethodIds();
loadClassDefs();
- markInternalClasses();
+ markInternalClasses(includeLineageClasses);
}
/**
@@ -290,7 +290,7 @@ public class DexData {
* Sets the "internal" flag on type IDs which are defined in the
* DEX file or within the VM (e.g. primitive classes and arrays).
*/
- void markInternalClasses() {
+ void markInternalClasses(boolean includeLineageClasses) {
for (int i = mClassDefs.length -1; i >= 0; i--) {
mTypeIds[mClassDefs[i].classIdx].internal = true;
}
@@ -298,6 +298,10 @@ public class DexData {
for (int i = 0; i < mTypeIds.length; i++) {
String className = mStrings[mTypeIds[i].descriptorIdx];
+ if (includeLineageClasses && className.startsWith("Llineageos")) {
+ mTypeIds[i].internal = false;
+ continue;
+ }
if (className.length() == 1) {
// primitive class
mTypeIds[i].internal = true;
diff --git a/tools/dexdeps/src/com/android/dexdeps/Main.java b/tools/dexdeps/src/com/android/dexdeps/Main.java
index 5e57ac12d..aa4aa3d60 100644
--- a/tools/dexdeps/src/com/android/dexdeps/Main.java
+++ b/tools/dexdeps/src/com/android/dexdeps/Main.java
@@ -40,6 +40,11 @@ public class Main {
private boolean mJustClasses = false;
/**
+ * Whether to include "lineageos" namespace classes in the dump.
+ */
+ private boolean mIncludeLineageClasses = false;
+
+ /**
* Entry point.
*/
public static void main(String[] args) {
@@ -65,7 +70,7 @@ public class Main {
List<RandomAccessFile> rafs = openInputFiles(fileName);
for (RandomAccessFile raf : rafs) {
DexData dexData = new DexData(raf);
- dexData.load();
+ dexData.load(mIncludeLineageClasses);
Output.generate(dexData, mOutputFormat, mJustClasses);
raf.close();
}
@@ -220,6 +225,8 @@ public class Main {
//System.out.println("+++ using format " + mOutputFormat);
} else if (arg.equals("--just-classes")) {
mJustClasses = true;
+ } else if (arg.equals("--include-lineage-classes")) {
+ mIncludeLineageClasses = true;
} else {
System.err.println("Unknown option '" + arg + "'");
throw new UsageException();