- String8 rule("-keep class ");
- rule += tag;
- rule += " { <init>(...); }";
-
- String8 location("view ");
- location += layoutFile->getSourceFile();
- char lineno[20];
- sprintf(lineno, ":%d", tree.getLineNumber());
- location += lineno;
-
- keep->add(rule, location);
+ addProguardKeepRule(keep, tag,
+ layoutFile->getPrintableSource(), tree.getLineNumber());
+ } else if (altTag != NULL && tag == altTag) {
+ ssize_t classIndex = tree.indexOfAttribute(NULL, "class");
+ if (classIndex < 0) {
+ fprintf(stderr, "%s:%d: <view> does not have class attribute.\n",
+ layoutFile->getPrintableSource().string(), tree.getLineNumber());
+ } else {
+ size_t len;
+ addProguardKeepRule(keep,
+ String8(tree.getAttributeStringValue(classIndex, &len)),
+ layoutFile->getPrintableSource(), tree.getLineNumber());
+ }