Merge change 21764 into eclair
* changes: Add aapt extensions to dump badging to print more info about activities, receivers and services Fix issue with checking end tags. Earlier some boolean variables were being set once a new tag is detected at the same level which causes some incorrect values to be overwritten. we should be doing this when we detect the end tag.
This commit is contained in:
@@ -503,8 +503,23 @@ int doDump(Bundle* bundle)
|
|||||||
bool withinActivity = false;
|
bool withinActivity = false;
|
||||||
bool isMainActivity = false;
|
bool isMainActivity = false;
|
||||||
bool isLauncherActivity = false;
|
bool isLauncherActivity = false;
|
||||||
|
bool isSearchable = false;
|
||||||
bool withinApplication = false;
|
bool withinApplication = false;
|
||||||
bool withinReceiver = false;
|
bool withinReceiver = false;
|
||||||
|
bool withinService = false;
|
||||||
|
bool withinIntentFilter = false;
|
||||||
|
bool hasMainActivity = false;
|
||||||
|
bool hasOtherActivities = false;
|
||||||
|
bool hasOtherReceivers = false;
|
||||||
|
bool hasOtherServices = false;
|
||||||
|
bool hasWallpaperService = false;
|
||||||
|
bool hasImeService = false;
|
||||||
|
bool hasWidgetReceivers = false;
|
||||||
|
bool hasIntentFilter = false;
|
||||||
|
bool actMainActivity = false;
|
||||||
|
bool actWidgetReceivers = false;
|
||||||
|
bool actImeService = false;
|
||||||
|
bool actWallpaperService = false;
|
||||||
int targetSdk = 0;
|
int targetSdk = 0;
|
||||||
int smallScreen = 1;
|
int smallScreen = 1;
|
||||||
int normalScreen = 1;
|
int normalScreen = 1;
|
||||||
@@ -514,9 +529,48 @@ int doDump(Bundle* bundle)
|
|||||||
String8 activityLabel;
|
String8 activityLabel;
|
||||||
String8 activityIcon;
|
String8 activityIcon;
|
||||||
String8 receiverName;
|
String8 receiverName;
|
||||||
|
String8 serviceName;
|
||||||
while ((code=tree.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
|
while ((code=tree.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
|
||||||
if (code == ResXMLTree::END_TAG) {
|
if (code == ResXMLTree::END_TAG) {
|
||||||
depth--;
|
depth--;
|
||||||
|
if (depth < 2) {
|
||||||
|
withinApplication = false;
|
||||||
|
} else if (depth < 3) {
|
||||||
|
if (withinActivity && isMainActivity && isLauncherActivity) {
|
||||||
|
const char *aName = getComponentName(pkg, activityName);
|
||||||
|
if (aName != NULL) {
|
||||||
|
printf("launchable activity name='%s'", aName);
|
||||||
|
}
|
||||||
|
printf("label='%s' icon='%s'\n",
|
||||||
|
activityLabel.string(),
|
||||||
|
activityIcon.string());
|
||||||
|
}
|
||||||
|
if (!hasIntentFilter) {
|
||||||
|
hasOtherActivities |= withinActivity;
|
||||||
|
hasOtherReceivers |= withinReceiver;
|
||||||
|
hasOtherServices |= withinService;
|
||||||
|
}
|
||||||
|
withinActivity = false;
|
||||||
|
withinService = false;
|
||||||
|
withinReceiver = false;
|
||||||
|
hasIntentFilter = false;
|
||||||
|
isMainActivity = isLauncherActivity = false;
|
||||||
|
} else if (depth < 4) {
|
||||||
|
if (withinIntentFilter) {
|
||||||
|
if (withinActivity) {
|
||||||
|
hasMainActivity |= actMainActivity;
|
||||||
|
hasOtherActivities |= !actMainActivity;
|
||||||
|
} else if (withinReceiver) {
|
||||||
|
hasWidgetReceivers |= actWidgetReceivers;
|
||||||
|
hasOtherReceivers |= !actWidgetReceivers;
|
||||||
|
} else if (withinService) {
|
||||||
|
hasImeService |= actImeService;
|
||||||
|
hasWallpaperService |= actWallpaperService;
|
||||||
|
hasOtherServices |= (!actImeService && !actWallpaperService);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
withinIntentFilter = false;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (code != ResXMLTree::START_TAG) {
|
if (code != ResXMLTree::START_TAG) {
|
||||||
@@ -524,7 +578,7 @@ int doDump(Bundle* bundle)
|
|||||||
}
|
}
|
||||||
depth++;
|
depth++;
|
||||||
String8 tag(tree.getElementName(&len));
|
String8 tag(tree.getElementName(&len));
|
||||||
//printf("Depth %d tag %s\n", depth, tag.string());
|
//printf("Depth %d, %s\n", depth, tag.string());
|
||||||
if (depth == 1) {
|
if (depth == 1) {
|
||||||
if (tag != "manifest") {
|
if (tag != "manifest") {
|
||||||
fprintf(stderr, "ERROR: manifest does not start with <manifest> tag\n");
|
fprintf(stderr, "ERROR: manifest does not start with <manifest> tag\n");
|
||||||
@@ -656,6 +710,8 @@ int doDump(Bundle* bundle)
|
|||||||
} else if (depth == 3 && withinApplication) {
|
} else if (depth == 3 && withinApplication) {
|
||||||
withinActivity = false;
|
withinActivity = false;
|
||||||
withinReceiver = false;
|
withinReceiver = false;
|
||||||
|
withinService = false;
|
||||||
|
hasIntentFilter = false;
|
||||||
if(tag == "activity") {
|
if(tag == "activity") {
|
||||||
withinActivity = true;
|
withinActivity = true;
|
||||||
activityName = getAttribute(tree, NAME_ATTR, &error);
|
activityName = getAttribute(tree, NAME_ATTR, &error);
|
||||||
@@ -690,76 +746,88 @@ int doDump(Bundle* bundle)
|
|||||||
fprintf(stderr, "ERROR getting 'android:name' attribute for receiver: %s\n", error.string());
|
fprintf(stderr, "ERROR getting 'android:name' attribute for receiver: %s\n", error.string());
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
} else if (tag == "service") {
|
||||||
|
withinService = true;
|
||||||
|
serviceName = getAttribute(tree, NAME_ATTR, &error);
|
||||||
|
|
||||||
|
if (error != "") {
|
||||||
|
fprintf(stderr, "ERROR getting 'android:name' attribute for service: %s\n", error.string());
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (depth == 5) {
|
} else if ((depth == 4) && (tag == "intent-filter")) {
|
||||||
if (withinActivity) {
|
hasIntentFilter = true;
|
||||||
if (tag == "action") {
|
withinIntentFilter = true;
|
||||||
//printf("LOG: action tag\n");
|
actMainActivity = actWidgetReceivers = actImeService = actWallpaperService = false;
|
||||||
String8 action = getAttribute(tree, NAME_ATTR, &error);
|
} else if ((depth == 5) && withinIntentFilter){
|
||||||
if (error != "") {
|
String8 action;
|
||||||
fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n", error.string());
|
if (tag == "action") {
|
||||||
goto bail;
|
action = getAttribute(tree, NAME_ATTR, &error);
|
||||||
}
|
if (error != "") {
|
||||||
|
fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n", error.string());
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
|
if (withinActivity) {
|
||||||
if (action == "android.intent.action.MAIN") {
|
if (action == "android.intent.action.MAIN") {
|
||||||
isMainActivity = true;
|
isMainActivity = true;
|
||||||
//printf("LOG: isMainActivity==true\n");
|
actMainActivity = true;
|
||||||
}
|
}
|
||||||
} else if (tag == "category") {
|
} else if (withinReceiver) {
|
||||||
String8 category = getAttribute(tree, NAME_ATTR, &error);
|
if (action == "android.appwidget.action.APPWIDGET_UPDATE") {
|
||||||
if (error != "") {
|
actWidgetReceivers = true;
|
||||||
fprintf(stderr, "ERROR getting 'name' attribute: %s\n", error.string());
|
|
||||||
goto bail;
|
|
||||||
}
|
}
|
||||||
|
} else if (withinService) {
|
||||||
|
if (action == "android.view.InputMethod") {
|
||||||
|
actImeService = true;
|
||||||
|
} else if (action == "android.service.wallpaper.WallpaperService") {
|
||||||
|
actWallpaperService = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (action == "android.intent.action.SEARCH") {
|
||||||
|
isSearchable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tag == "category") {
|
||||||
|
String8 category = getAttribute(tree, NAME_ATTR, &error);
|
||||||
|
if (error != "") {
|
||||||
|
fprintf(stderr, "ERROR getting 'name' attribute: %s\n", error.string());
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
|
if (withinActivity) {
|
||||||
if (category == "android.intent.category.LAUNCHER") {
|
if (category == "android.intent.category.LAUNCHER") {
|
||||||
isLauncherActivity = true;
|
isLauncherActivity = true;
|
||||||
//printf("LOG: isLauncherActivity==true\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (withinReceiver) {
|
|
||||||
if (tag == "action") {
|
|
||||||
String8 action = getAttribute(tree, NAME_ATTR, &error);
|
|
||||||
if (error != "") {
|
|
||||||
fprintf(stderr, "ERROR getting 'android:name' attribute for receiver: %s\n", error.string());
|
|
||||||
goto bail;
|
|
||||||
}
|
|
||||||
if (action == "android.appwidget.action.APPWIDGET_UPDATE") {
|
|
||||||
const char *rName = getComponentName(pkg, receiverName);
|
|
||||||
if (rName != NULL) {
|
|
||||||
printf("gadget-receiver:'%s/%s'\n", pkg.string(), rName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (depth < 2) {
|
|
||||||
withinApplication = false;
|
|
||||||
}
|
|
||||||
if (depth < 3) {
|
|
||||||
//if (withinActivity) printf("LOG: withinActivity==false\n");
|
|
||||||
withinActivity = false;
|
|
||||||
withinReceiver = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (depth < 5) {
|
|
||||||
//if (isMainActivity) printf("LOG: isMainActivity==false\n");
|
|
||||||
//if (isLauncherActivity) printf("LOG: isLauncherActivity==false\n");
|
|
||||||
isMainActivity = false;
|
|
||||||
isLauncherActivity = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (withinActivity && isMainActivity && isLauncherActivity) {
|
|
||||||
printf("launchable activity:");
|
|
||||||
const char *aName = getComponentName(pkg, activityName);
|
|
||||||
if (aName != NULL) {
|
|
||||||
printf(" name='%s'", aName);
|
|
||||||
}
|
|
||||||
printf("label='%s' icon='%s'\n",
|
|
||||||
activityLabel.string(),
|
|
||||||
activityIcon.string());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasMainActivity) {
|
||||||
|
printf("main\n");
|
||||||
|
}
|
||||||
|
if (hasWidgetReceivers) {
|
||||||
|
printf("app-widget\n");
|
||||||
|
}
|
||||||
|
if (hasImeService) {
|
||||||
|
printf("ime\n");
|
||||||
|
}
|
||||||
|
if (hasWallpaperService) {
|
||||||
|
printf("wallpaper\n");
|
||||||
|
}
|
||||||
|
if (hasOtherActivities) {
|
||||||
|
printf("other-activities\n");
|
||||||
|
}
|
||||||
|
if (isSearchable) {
|
||||||
|
printf("search\n");
|
||||||
|
}
|
||||||
|
if (hasOtherReceivers) {
|
||||||
|
printf("other-receivers\n");
|
||||||
|
}
|
||||||
|
if (hasOtherServices) {
|
||||||
|
printf("other-services\n");
|
||||||
|
}
|
||||||
|
|
||||||
// Determine default values for any unspecified screen sizes,
|
// Determine default values for any unspecified screen sizes,
|
||||||
// based on the target SDK of the package. As of 4 (donut)
|
// based on the target SDK of the package. As of 4 (donut)
|
||||||
// the screen size support was introduced, so all default to
|
// the screen size support was introduced, so all default to
|
||||||
@@ -778,7 +846,7 @@ int doDump(Bundle* bundle)
|
|||||||
if (normalScreen != 0) printf(" 'normal'");
|
if (normalScreen != 0) printf(" 'normal'");
|
||||||
if (largeScreen != 0) printf(" 'large'");
|
if (largeScreen != 0) printf(" 'large'");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("locales:");
|
printf("locales:");
|
||||||
Vector<String8> locales;
|
Vector<String8> locales;
|
||||||
res.getLocales(&locales);
|
res.getLocales(&locales);
|
||||||
@@ -791,7 +859,7 @@ int doDump(Bundle* bundle)
|
|||||||
printf(" '%s'", localeStr);
|
printf(" '%s'", localeStr);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
Vector<ResTable_config> configs;
|
Vector<ResTable_config> configs;
|
||||||
res.getConfigurations(&configs);
|
res.getConfigurations(&configs);
|
||||||
SortedVector<int> densities;
|
SortedVector<int> densities;
|
||||||
@@ -801,14 +869,14 @@ int doDump(Bundle* bundle)
|
|||||||
if (dens == 0) dens = 160;
|
if (dens == 0) dens = 160;
|
||||||
densities.add(dens);
|
densities.add(dens);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("densities:");
|
printf("densities:");
|
||||||
const size_t ND = densities.size();
|
const size_t ND = densities.size();
|
||||||
for (size_t i=0; i<ND; i++) {
|
for (size_t i=0; i<ND; i++) {
|
||||||
printf(" '%d'", densities[i]);
|
printf(" '%d'", densities[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
AssetDir* dir = assets.openNonAssetDir(assetsCookie, "lib");
|
AssetDir* dir = assets.openNonAssetDir(assetsCookie, "lib");
|
||||||
if (dir != NULL) {
|
if (dir != NULL) {
|
||||||
if (dir->getFileCount() > 0) {
|
if (dir->getFileCount() > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user