summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2014-06-11 17:43:37 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-06-11 17:43:37 +0000
commitb572d3ca3f641f754673dc0a0cf1b5183ee4dffd (patch)
tree8aa98f8aa0532b4e30ad79cf32534d1a614335cb /src
parentcbc60decb8169f18422c25ae8a384e5d91cdfe74 (diff)
parentdf8d48b6dab0a1d5f354266e6617877f177894cf (diff)
downloadandroid_external_doclava-b572d3ca3f641f754673dc0a0cf1b5183ee4dffd.tar.gz
android_external_doclava-b572d3ca3f641f754673dc0a0cf1b5183ee4dffd.tar.bz2
android_external_doclava-b572d3ca3f641f754673dc0a0cf1b5183ee4dffd.zip
am df8d48b6: Ensure LayoutParams in widgets.txt are in correct package.
* commit 'df8d48b6dab0a1d5f354266e6617877f177894cf': Ensure LayoutParams in widgets.txt are in correct package.
Diffstat (limited to 'src')
-rw-r--r--src/com/google/doclava/Doclava.java32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/com/google/doclava/Doclava.java b/src/com/google/doclava/Doclava.java
index 102c5c5..ca2021d 100644
--- a/src/com/google/doclava/Doclava.java
+++ b/src/com/google/doclava/Doclava.java
@@ -1480,6 +1480,9 @@ public class Doclava {
ClassInfo[] classes = Converter.allClasses();
+ // The topmost LayoutParams class - android.view.ViewGroup.LayoutParams
+ ClassInfo topLayoutParams = null;
+
// Go through all the fields of all the classes, looking SDK stuff.
for (ClassInfo clazz : classes) {
@@ -1533,10 +1536,12 @@ public class Doclava {
}
if (annotated == false) {
- // lets check if this is inside android.widget
- PackageInfo pckg = clazz.containingPackage();
- String packageName = pckg.name();
- if ("android.widget".equals(packageName) || "android.view".equals(packageName)) {
+ if (topLayoutParams == null
+ && "android.view.ViewGroup.LayoutParams".equals(clazz.qualifiedName())) {
+ topLayoutParams = clazz;
+ }
+ // let's check if this is inside android.widget or android.view
+ if (isIncludedPackage(clazz)) {
// now we check what this class inherits either from android.view.ViewGroup
// or android.view.View, or android.view.ViewGroup.LayoutParams
int type = checkInheritance(clazz);
@@ -1577,9 +1582,14 @@ public class Doclava {
// before writing the list of classes, we do some checks, to make sure the layout params
// are enclosed by a layout class (and not one that has been declared as a widget)
for (int i = 0; i < layoutParams.size();) {
- ClassInfo layoutParamClass = layoutParams.get(i);
- ClassInfo containingClass = layoutParamClass.containingClass();
- if (containingClass == null || layouts.indexOf(containingClass) == -1) {
+ ClassInfo clazz = layoutParams.get(i);
+ ClassInfo containingClass = clazz.containingClass();
+ boolean remove = containingClass == null || layouts.indexOf(containingClass) == -1;
+ // Also ensure that super classes of the layout params are in android.widget or android.view.
+ while (!remove && (clazz = clazz.superclass()) != null && !clazz.equals(topLayoutParams)) {
+ remove = !isIncludedPackage(clazz);
+ }
+ if (remove) {
layoutParams.remove(i);
} else {
i++;
@@ -1590,6 +1600,14 @@ public class Doclava {
}
/**
+ * Check if the clazz is in package android.view or android.widget
+ */
+ private static boolean isIncludedPackage(ClassInfo clazz) {
+ String pckg = clazz.containingPackage().name();
+ return "android.widget".equals(pckg) || "android.view".equals(pckg);
+ }
+
+ /**
* Writes a list of values into a text files.
*
* @param pathname the absolute os path of the output file.