+static void printCompatibleScreens(ResXMLTree& tree) {
+ size_t len;
+ ResXMLTree::event_code_t code;
+ int depth = 0;
+ bool first = true;
+ printf("compatible-screens:");
+ while ((code=tree.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
+ if (code == ResXMLTree::END_TAG) {
+ depth--;
+ if (depth < 0) {
+ break;
+ }
+ continue;
+ }
+ if (code != ResXMLTree::START_TAG) {
+ continue;
+ }
+ depth++;
+ String8 tag(tree.getElementName(&len));
+ if (tag == "screen") {
+ int32_t screenSize = getIntegerAttribute(tree,
+ SCREEN_SIZE_ATTR, NULL, -1);
+ int32_t screenDensity = getIntegerAttribute(tree,
+ SCREEN_DENSITY_ATTR, NULL, -1);
+ if (screenSize > 0 && screenDensity > 0) {
+ if (!first) {
+ printf(",");
+ }
+ first = false;
+ printf("'%d/%d'", screenSize, screenDensity);
+ }
+ }
+ }
+ printf("\n");
+}
+